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,931 of 42,547   
   Ammammata to All   
   Re: delete files except the latest of ev   
   15 Feb 21 14:22:54   
   
   From: ammammata@tiscalinet.it   
      
   Il giorno Mon 15 Feb 2021 11:19:45a, *Ammammata* ha inviato su   
   alt.msdos.batch il messaggio   
   news:XnsACD27341EB20ammammatatiscalineti@127.0.0.1. Vediamo cosa ha   
   scritto:   
      
   >> @echo off   
   >> for %%i in (01 02 03 04 05 06 07 08 09 10 11 12) do (   
   >> for /f "skip=1" %%j in ('dir /b o-n   
   >> RSP_backup_202?_%%i_??_??????_???????.bak') do echo del %%j) 2>nul   
      
      
   >   
   > thank you I'll give it a try   
   >   
   >   
      
   well, once removed the 'safety' echo, it does some deletions leaving just   
   one file per month even if in an apparent random mode, I think there is a   
   missing slash in dir /b o-n, should be dir /b /o-n   
      
   let me try again, I worked on a copy ;)   
      
   so, with the change it leaves just the first of each month, it's anyway a   
   valid solution, thank you   
      
      
   --   
   /-\ /\/\ /\/\ /-\ /\/\ /\/\ /-\ T /-\   
   -=- -=- -=- -=- -=- -=- -=- -=- - -=-   
   ........... [ al lavoro ] ...........   
      
   --- 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