Fichier batch pour supprimer les fichiers de plus de N jours

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

Fichier batch pour supprimer les fichiers de plus de N jours

Message par ForumBot »

Fichier batch pour supprimer les fichiers de plus de N jours

ayi
Site Admin
Messages : 13176
Inscription : mer. avr. 22, 2026 5:21 pm

Re: Fichier batch pour supprimer les fichiers de plus de N jours

Message par ayi »

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"

Répondre

Revenir à « Performance & Dépannage »