home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   alt.msdos.batch.nt      Fun with Windows NT batch files      68,980 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 68,023 of 68,980   
   Herbert Kleebauer to Andy Ho   
   Re: move a fixed number of files between   
   11 Mar 23 09:30:27   
   
   From: klee@unibwm.de   
      
   On 10.03.2023 17:55, Andy Ho wrote:   
   > On Sunday, May 7, 2017 at 2:37:12 PM UTC+7, Herbert Kleebauer wrote:   
   >> On 06.05.2017 18:49, hvd...@gmail.com wrote:   
   >>   
   >> >> > Eg: I have a folder A contains 100.000 files. I want to have a   
   >> >> > code that click one time move 5000 files from A to folder 1, 2, ...,   
   19, 20.   
   >> >>   
   >> >> @echo off   
   >> >> set SourceDir=C:\dir1   
   >> >> set TargetDir=C:\dir2   
   >> >> set MaxFiles=100   
   >> >>   
   >> >> set m=0   
   >> >> set n=0   
   >> >>   
   >> >> for /f %%i in ('dir /b /a-d "%SourceDir%\*.*"') do call :sub %%i   
   >> >> goto :eof   
   >> >>   
   >> >> :sub   
   >> >> if not %m%==0 goto :s1   
   >> >> set /a n=n+1   
   >> >> mkdir %TargetDir%\%n%   
   >> >> set m=%MaxFiles%   
   >> >>   
   >> >> :s1   
   >> >> move %SourceDir%\%1 %TargetDir%\%n%\ >nul   
   >> >> set /a m=m-1   
   >> >> goto :eof   
      
   > cannot works, please help   
      
   If you want help, you have to be little bit more specific.   
   What exactly do you want to do and and what doesn't work?   
      
   --- 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