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 40,911 of 42,547   
   John Harris to All   
   Batch file to Stripping zeros from page    
   28 Feb 14 07:51:47   
   
   From: john.harris57@gmail.com   
      
   What I want to do is run batch file to strip of the leading zeros from the   
   page number at the end of the file name.   
      
   I thought of doing this generically but i need the date format left alone.   
      
   So 0101 becomes 101 or 090 become 90, 01 becomes 1.   
      
   The files will be located in directory/folder.   
      
   I started to look at number count to positions, but not sure if that the best   
   way to do it am a little stuck at the moment suggestion very welcome.   
      
   File name = 05-10-2012#MilitaryPkk-#Books_0101.Pdf   
      
   As you see the its going to be 4, 3 or 2 digits it will in the file name.   
      
   set FRONTEND=%FILENAME:~0,23%   
   set MIDDLE=%FILENAME:~23,6%   
   set UNDERSCORE=%FILENAME:~29,1%   
      
   set LOGFILE=c:\testLog.txt   
   echo FRONTEND: %FRONTEND% >> %LOGFILE%   
   echo MIDDLE: %MIDDLE% >> %LOGFILE%   
   echo UNDERSCORE: %UNDERSCORE% >> %LOGFILE%   
      
   Regards   
      
   John Harris   
      
   --- 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