Fichier batch pour supprimer les fichiers de plus de N jours

Fichier batch pour supprimer les fichiers de plus de N jours

Profitez-en :

forfiles -p "C:\what\ever" -s -m *.* -d <number of days> -c "cmd /c del @path"

Voir la documentation de forfiles for more details.

Pour plus de ressources, consultez An A-Z Index of the Windows XP command line.

Si vous n’avez pas forfiles installé sur votre machine, copiez-le depuis n’importe quel Windows Server 2003 to your Windows XP machine at %WinDir%\system32\. This is possible since the EXE is fully compatible between Windows Server 2003 and Windows XP.

Later versions of Windows and Windows Server have it installed by default.

For Windows 7 and newer (including Windows 10):

La syntaxe a un peu changé. La commande mise à jour est donc :

forfiles /p "C:\what\ever" /s /m *.* /D -<number of days> /C "cmd /c del @path"