4e48be21   
   On Thursday, December 17, 2009 at 12:43:31 PM UTC, Brett wrote:   
   > On 17 Dec, 11:23, foxidrive wrote:   
   > > On Thu, 17 Dec 2009 00:50:15 -0800 (PST), Brett    
   > > wrote:   
   > >   
   > > >I have a batch file I use to rename files with the date and time   
   > > >stamp:   
   > >   
   > > >RENAME W:\TEST.TXT TEST_%date:~-4,4%%date:~-7,2%%date:~0,2%_%time:~0,2%   
   > > >%time:~3,2%%time:~6,2%.TXT   
   > >   
   > > >This will work correctly if the time is after 10AM, if the time is   
   > > >between 01:00 and 09:59 it will fail. Can anyone help me out and let   
   > > >me know why?   
   > >   
   > > The time will have a leading space character beween 1 and 10am and your   
   > > rename command doesn't support longfilename elements.   
   > >   
   > > >For example if I run the BATCH file at 10:01 I will see   
   > > >TEST_20091217_100112.TXT, if I run it at 09:58 the file command fails   
   > > >with error "The syntax of the command is incorrect."   
   > >   
   > > This should be more robust:   
   > >   
   > > set d=%date:~-4,4%%date:~-7,2%%date:~0,2%   
   > > set d=%d: =_%   
   > > set t=%time:~0,2%%time:~3,2%%time:~6,2%   
   > > set t=%t: =0%   
   > >   
   > > RENAME "W:\TEST.TXT" "TEST_%d%_%t%.TXT"   
   >    
   > Thank you foxidrive, this is perfect.   
      
      
   Thank You Foxidrive, This really helped and working fine   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|