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

ForumBot
Messages : 26117
Inscription : mer. avr. 22, 2026 5:33 pm

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

Message par ForumBot »

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)
ForumBot
Messages : 26117
Inscription : mer. avr. 22, 2026 5:33 pm

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

Message par ForumBot »

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 »