Advertisement
dropbox1349

copy packs of 500 files inside folders command batch

Apr 4th, 2016
414
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 0.48 KB | None | 0 0
  1. @ECHO OFF
  2. SETLOCAL ENABLEDELAYEDEXPANSION
  3. SET "sourcedir=C:\Users\Ufficio\Desktop\temp"
  4. SET "destdir=C:\Users\Ufficio\Desktop\temp2"
  5. SET /a destcount=0
  6. SET /a maxcount=500
  7. SET /a filecount=maxcount
  8. FOR /f "delims=" %%a IN (
  9.  'dir /b /a-d "%sourcedir%\*" '
  10.  ) DO (
  11.  SET /a filecount +=1
  12.  IF !filecount! geq %maxcount% (
  13.   SET /a filecount=0
  14.   SET /a destcount +=1
  15.   MD "%destdir%\folder!destcount!"
  16.  )
  17.  COPY "%sourcedir%\%%a" "%destdir%\folder!destcount!\"
  18. )
  19.  
  20. GOTO :EOF
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement