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,022 of 68,980   
   Andy Ho to Herbert Kleebauer   
   Re: move a fixed number of files between   
   10 Mar 23 08:55:01   
   
   From: andxho@gmail.com   
      
   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    
   > >    
   > > sorry, I don't know anything about codes.   
   > Sorry, but if you want to use batch files, you have    
   > to learn at least the basics. Batch files are not    
   > ready-to-use programs.   
   > > Can you show me what and where I have to edit?   
   > These are your lines of code, I didn't modify them:   
   > >> set SourceDir=C:\dir1    
   > >> set TargetDir=C:\dir2    
   > >> set MaxFiles=100   
   > > Eg: Folder D:\A contains 100 files, maxfiles=20, and subfolder D:\A\1,   
   ..., D:\A\5   
   > And why don't you change your own lines to:    
   >    
   > set SourceDir=D:\A    
   > set TargetDir=D:\A    
   > set MaxFiles=20   
      
      
   cannot works, please help   
      
   --- 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