home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   alt.msdos.batch      Fun with MS-DOS batch files      42,547 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 41,007 of 42,547   
   foxidrive to justin.lamantia@gmail.com   
   Re: Batch File to Create 25 backs up the   
   19 Sep 14 02:35:12   
   
   From: foxidrive@server.invalid   
      
   On 19/09/2014 02:11, justin.lamantia@gmail.com wrote:   
   > Basically a circulatory back up that keeps the newest 25 folders always...   
      
   Test this - it changes to a folder and then lists the oldest folders if there   
   are more than 25   
   folders in there.  The && ensures that the FOR command only runs if the folder   
   is located.   
      
   The key is to sort the DIR by reverse date using /O-D   
      
   @echo off   
   pushd "c:\folder" && FOR /F "skip=25 delims=" %%a IN ('DIR /B /AD /O-D') DO   
   echo RD /S /Q "%%a"   
   pause   
      
      
   Remove the echo to let it delete the folders.   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca