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,066 of 68,980   
   Andy Ho to Herbert Kleebauer   
   Re: move a fixed number of files between   
   14 Jun 23 10:53:51   
   
   From: andxho@gmail.com   
      
   On Saturday, March 11, 2023 at 3:30:29 PM UTC+7, Herbert Kleebauer wrote:   
   > On 10.03.2023 17:55, Andy Ho wrote:    
   > > On Sunday, May 7, 2017 at 2:37:12 PM UTC+7, Herbert Kleebauer 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?   
   only 3 folder was created and the file not all moved (only 5 files and the   
   rest still in the first folder)   
      
   --- 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