Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 526
  • Last Modified:

Copying files in batches from a server to another mapped drive folder

Hi,

 I have a folder called SRCFILES which has some 15000 files. I want to write a batch that copies these files in batches of <n> to another drive folder say \\XOXO\DESTFILES. They are sorted by filename.

How can I do this?
0
LuckyLucks
Asked:
LuckyLucks
1 Solution
 
Sam SawalhiIT ConsultantCommented:
Folder Copy and backup works very well and it is free...

http://download.cnet.com/Folder-Copy-Backup/3000-2248_4-10876816.html


I hope this helps!
0
 
Mohammed KhawajaCommented:
Try Robocopy as it is great for copying/synchronizing folders. Can pickup where it left off copying files, bit level changes, etc.
0
 
Bill PrewCommented:
Can you share a little more about what you are trying to accomplish and how you will process these batches?  Why are you breaking the copy up into batches?  Is speed a concern?  Etc...

~bp
0
 
leflonCommented:
Hi,

if you want to stick to basic cmd syntax you could try the following to move a given number of files

echo off
SETLOCAL EnableDelayedExpansion
set noOfMovedFiles=0
for /R .\src\ %%N in (*) do (
    echo moving... "%%N"
    move /Y "%%N" .\dest\
    set /a noOfMovedFiles+="1"
	REM Stop once you moved 5 files.
    if !noOfMovedFiles! EQU 5 GOTO endOfCopy
  )
  :endOfCopy
  echo Done, Copied %noOfMovedFiles% files!
  pause
ENDLOCAL

Open in new window

Here I only move 5 files. You have to adjust the number and the src and dest directories.
Additionally you have to wrap this with a loop that continues copying while there are still files in the src directory.

hth
leflon
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now