Comment supprimer fichiers from a dossier using a list of fichier names in windows?

Clippy
Messages : 22157
Inscription : mer. 22 avr. 2026, 17:33

Comment supprimer fichiers from a dossier using a list of fichier names in windows?

Message par Clippy »

i have a folder with 2K+ files in it, i need to delete around 200, i have a txt file with all the nom de fichiers i need removed ordered in a list, how do i remove the specific files from the folder using the list? (OS is windows 7)
Clippy
Messages : 22157
Inscription : mer. 22 avr. 2026, 17:33

Re: Comment supprimer fichiers from a dossier using a list of fichier names in windows?

Message par Clippy »

Type this on the ligne de commande, substituting your file for `files_to_delete.txt`:

```
for /f %i in (files_to_delete.txt) do del %i

```

A version of this suitable to include in `.cmd` files (double %%) and able to deal with spaces in nom de fichiers:

```
for /f "delims=" %%f in (files_to_delete.txt) do del "%%f"

```
Répondre

Revenir à « Personnalisation Windows »