Move x number of files to mutiples servers

rated by 0 users
This post has 2 Replies | 1 Follower

Not Ranked
Posts 3
pkuma004 Posted: 12-14-2011 3:42 AM

I have a server with seven directories and each directory contains 1000's of files. I need to move first 100 files to server1 then next 100 files to server2,etc. Once it finishes with the first directory then it needs to proceed with the second directory. Each directory contains sets of two files which needs to be copied to same server. See the example below.

Can someone please provide me a powershell script with can archieve this?

Example

Server1

dir1
file1.txt, file1.dat, file2.txt, file2.dat, file3.txt, file3.dat, ......
dir2
file1a.txt, file1a.dat, file2a.txt, file2a.dat, file3a.txt, file3a.dat, ......

Top 10 Contributor
Posts 296
Microsoft MVP
Top Contributor

Need a bit more information on this one

Server has 7 folders each with 1000s of files.

For folder 1

You want to move 1st 100 files to server1, 2nd 100 to server 2 etc.

What happens after each server has received 100 files?  Do you want to start at server1 again? 

What is the criteria of ordering files - name, age, size?

Is there a single destination folder on each of the destination servers or do you want the current folder structure to be preserved? 

 

Not Ranked
Posts 3

For folder 1

You want to move 1st 100 files to server1, 2nd 100 to server 2 etc.

What happens after each server has received 100 files? Do you want to start at server1 again? Yes, it should start at server1.  

What is the criteria of ordering files - name, age, size? Only criteria is the pairs of files should only be copied. i.e.. abc.txt and abc.dat, xyz.txt and xyz.dat

Is there a single destination folder on each of the destination servers or do you want the current folder structure to be preserved? The folder structure are all same on all the servers. It is only the files getting copied to folder \\server1\a\b to server2\a\b

Hopefully this answers all the questions. 

 

Page 1 of 1 (3 items) | RSS
Copyright 2012 PowerShell.com. All rights reserved.