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,685 of 42,547   
   Herbert Kleebauer to oldyork90@yahoo.com   
   Re: flatten file system - copy - no over   
   19 Jul 13 17:28:49   
   
   From: klee@unibwm.de   
      
   On 19.07.2013 15:50, oldyork90@yahoo.com wrote:   
      
   > The batch should begin in a root and inspect it and all sub-directories.   
   > If it finds a file with a defined extension (like jpg, tiff ....) it should   
   > copy it to the flat directory.   
      
   Your destination directory must not be a subdirectory of the source   
   directory.   
      
      
   @echo off   
   set source=d:\pictures   
   set dest=d:\allpict   
      
   for /f "tokens=*" %%i in ('dir /s /b %source%\*.jpg') do call :sub "%%i"   
   goto :eof   
      
   :sub   
   set s=%1   
   set d=%s::=;%   
   set d=%d:\=!%   
   :loop   
   if exist %dest%\%d% set d=#%d% & goto :loop   
   echo %s%   
   copy %s%  %dest%\%d% >null   
      
   --- 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