. bat delete files older than 1 month

fred8669 Posted messages 3 Status Member -  
 Anonyme -
Hello,
I WANT TO CREATE a .BAT so that it runs at startup to delete files older than 1 month. THANKS in advance.

11 answers

  1. cpourvous
     
    :: Purging files older than 30 days from D:\PUK7\Partenaire\DIFFUSION

    setlocal

    SET SOURCE=D:\PUK7\Partenaire\DIFFUSION
    SET TARGET=C:\TEMP
    SET AGE=30
    : Deleting old files older than 30 days

    For /F %%d in ('robocopy %SOURCE% %TARGET% /minage:%AGE% /L /XX /NC /NS /NDL /NJH /NJS /NP') do del %%d

    :end
    15
    1. Dinot
       
      Thank you for this script, it’s really effective.
      0
    2. Anonyme
       
      Thank you for the information.
      0