Deprecated: Creation of dynamic property Timber\Site::$pingback is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Site.php on line 180

Deprecated: Creation of dynamic property Timber\User::$name is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/User.php on line 118

Deprecated: Creation of dynamic property Timber\Post::$old_id is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$_thumbnail_id is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$ext-thumbnail_url is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$_edit_last is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$_yoast_wpseo_metadesc is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$post_date_gmt is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$comment_status is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$ping_status is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$post_password is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$post_name is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$to_ping is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$pinged is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$post_modified is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$post_modified_gmt is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$post_content_filtered is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$guid is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$menu_order is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$post_mime_type is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$comment_count is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$filter is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71

Deprecated: Creation of dynamic property Timber\Post::$status is deprecated in /var/www/html/web/app/themes/ilsoftware/vendor/timber/timber/lib/Core.php on line 71
Come rinominare file in blocco con Windows 10 | IlSoftware.it

Come rinominare file in blocco con Windows 10

Rinominare file in Windows 10 dall'interfaccia del sistema operativo usando Esplora file, il prompt dei comandi oppure PowerShell.

Capita spesso di avere l’esigenza di rinominare tanti file in un’unica passata. Si pensi ad esempio ai file provenienti da una fotocamera digitale, dallo smartphone, da una videocamera, da un dispositivo per l’Internet delle Cose (IoT). Come si possono rinominare file e cartelle in blocco usando l’interfaccia di Windows 10?

Rinominare file da Esplora file premendo CTRL+A

Premendo Windows+E per aprire una finestra di Esplora file quindi portandosi nella cartella contenente i file da rinominare, basterà selezionarli premendo CTRL+A.

Cliccando quindi con il tasto destro del mouse su uno dei file quindi scegliendo Rinomina, si potrà assegnare il prefisso da assegnare a ciascun file.
Digitando ad esempio foto e premendo Invio, Windows 10 userà foto come nome di ciascun file aggiungendo poi (1), (2), (3) e così via a tutti gli elementi presenti nella stessa cartella.

Il numero progressivo parte da uno tenendo presente ciascuna tipologia di file.

L’operazione è eventualmente annullabile dopo aver rinominato file e cartelle premendo la combinazione di tasti CTRL+Z.

Rinominare file dal prompt dei comandi

Portandosi sempre nella cartella contenente i file da rinominare, tenendo premuto il tasto MAIUSC quindi cliccando con il pulsante destro del mouse in un’area libera, si potrà scegliere Apri finestra PowerShell qui.

Se i nomi dei file avessero una lunghezza prefissata si può aggiungere un suffisso digitando quanto segue:

cmd
ren *.* ??????????-test.*

In questo caso tutti i file nella cartella hanno un nome pari a 10 caratteri: da qui l’utilizzo di dieci caratteri ?. Se i nomi dei file avessero una lunghezza differente si possono inserire tanti punti interrogativi quanti sono i caratteri che compongono il nome del file più lungo.

Allo stesso modo, per rimuovere una parte di un file si può usare la seguente sintassi:

ren ?????-test.docx ?????.docx

In questo caso verrà rimosso il suffisso -test da tutti i file con estensione .DOCX mantenendo nel nome solamente i primi cinque caratteri.

Rinominare file con PowerShell

Applicando la procedura vista al paragrafo precedente (tasto destro, Apri finestra PowerShell qui) si possono rinominare in batch più file presenti in una stessa cartella. Questa volta non bisognerà digitare il comando iniziale cmd e si potrà usare direttamente la sintassi PowerShell.

L’istruzione seguente consente di sostituire tutte le eventuali occorrenze della stringa FOTO all’interno dei nomi dei file:

Dir | Rename-Item -NewName { $_.name -replace "FOTO","-TEST" }

Nell’esempio la stringa FOTO utilizzata in qualunque parte del nome di ciascun file viene sostituita con -TEST.

I comandi seguenti permettono invece di rinominare tutti i file secondo lo schema indicato:

$nr=1
Dir | %{Rename-Item $_ -NewName ("lavori2020-{0}.docx" -f $nr++)}

Al posto di lavori2020-{0}.docx va indicato lo schema per i nomi dei file che deve essere utilizzato. Nell’esempio a tutti i file sarà assegnato il nome lavori2020-, applicato un numero crescente a partire da 1 e assegnata l’estensione .docx indipendentemente da quella presente.

Se si volessero sostituire stringhe di caratteri presenti nei nomi dei file, anche memorizzati nelle sottocartelle, si può usare la sintassi seguente:

Get-ChildItem -Filter "*test*" -Recurse | Rename-Item -NewName {$_.name -replace 'test','new' }

In questo caso viene utilizzato PowerShell per cercare tutti i file contenenti, nella cartella corrente e nelle sottocartelle, la stringa test nel nome. Tale stringa viene automaticamente sostituita con new.

Ulteriori spunti pratici nell’articolo Come rinominare una serie di file con Powershell.

In alternativa si possono utilizzare strumenti come Bulk Rename Utility oppure PowerRename, parte dei nuovi Microsoft PowerToys per Windows 10: Rinominare più file con Microsoft PowerRename.

Ti consigliamo anche

Link copiato negli appunti