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,674 of 42,547    |
|    John Harris to All    |
|    Any suggestion - Create directory based     |
|    12 Jun 13 15:38:37    |
   
   From: john.harris57@gmail.com   
      
       
   What I would like to do is take a file called (eg) EW120613001.pdf and save it   
   into \\server\share\FOLDER\6 digit ddmmyy from filename \EW120613001.pdf   
      
   6 digit ddmmyy from filename and creates directory and errors the creation   
   based on directory is there already then move the file into that diectory.   
      
      
      
   I used this previously, but I don't have a constant _ delimiter my first   
      
      
      
   ==========================================================   
      
   :: Script to take a file with a page number at the beginning in one or two   
   digits digits before underscore _ underscore and move the   
   :: named file into the numbered folder located at a location set in variable   
   number 5.   
   :: Copy from here into the script params >%JOB_NAME %INPUT_FOLDER %OK_FOLDER   
   %LOG_FOLDER D:\Folder\SCRIPTS\product\pages   
   ::   
   :: Change the physical path to UNC path   
   ::   
   :: parameters   
   :: 1. jobname   
   :: 2. inputfolder   
   :: 3. outputfolder   
   :: 4. logfolder (script Log output)   
   :: 5. product_pages (path included in the script params must be a unc path)   
      
   @echo off   
      
   For /R %2 %%a in (*.*) do (   
    for /f "delims=_" %%b in ("%%~na") do (   
    echo moved "%%a" "%5\%%b" >> %4\%1.log   
    md "%5\%%b" 2>nul   
    move /Y "%%a" "%5\%%b\" >nul   
    )   
   )   
      
   --- 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