Solved

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

Posted on 2014-04-18
4
520 Views
Last Modified: 2014-05-09
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
Comment
Question by:LuckyLucks
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 4

Expert Comment

by:wsawalhi
ID: 40009190
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
 
LVL 25

Expert Comment

by:Mohammed Khawaja
ID: 40009241
Try Robocopy as it is great for copying/synchronizing folders. Can pickup where it left off copying files, bit level changes, etc.
0
 
LVL 55

Accepted Solution

by:
Bill Prew earned 500 total points
ID: 40009811
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
 
LVL 7

Expert Comment

by:leflon
ID: 40024516
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

Is Your DevOps Pipeline Leaking?

Is your CI/CD pipeline a hodge-podge of randomly connected tools? You’ve likely got a tool to fix one problem & then a different tool to fix another, resulting in a cluster of tools with overlapping functionality. Learn how to optimize your pipeline with Gartner's recommendations

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When you receive another warning that your shared drive is almost full and you have asked your users to clean out old files again and again, here is a single command that may help. This command will place all the files that have not been used rec…
AutoHotkey is an excellent, free, open source programming/scripting language for Windows. It started out as a keyboard/mouse macros product, but has expanded into a robust language. This article provides an introduction to it, with links to addition…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question