Has anyone built a program/script to transfer files between 2 hard drives, but like if both are near full....so one copies 1 file over then the other copies the other file, then they delete the files that were copied?

Kind of annoying, have a 6tb raid at about 4tb full, then 1 4.5tb basically full, can't really swap them easily....without doing many copies and deletes of files....

Anyone know a way to make them just swap? lol

  • I guess you will not find such a program. Think what happens if the operation is interrupted, your files will become totally broken. Try archiving these files or use a temporary storage, e.g. a flash drive. – bytebuster Nov 21 '12 at 10:10
  • Would love to find a flash drive that's 4.5tb -.- >_< I don't have enough spare storage to do this quickly that's the main problem – Josip Gòdly Zirdum Nov 21 '12 at 10:15
  • Ah Tera. Sorry for a misleading idea. Well, it looks you have 6-4=2Tb free space on the 1st RAID and 4.5Tb data on each. It's only 3 iterations, not that annoying. :) – bytebuster Nov 21 '12 at 10:23
  • Not terrible, just annoying as can't leave it to go on while I sleep. – Josip Gòdly Zirdum Nov 21 '12 at 10:32

The simplest way is writing a small script (batch file) would be sufficient.

Assuming you have 1.5Tb on one of the drives, identify three blocks of 1.5Tb on each drive and write a batch file that will do the job.

You may also semi-automate this process. Assuming you are on Windows, want to copy drives X: and Y:, and each file is smaller than your free space (1.5Tb).
Robocopy which is a part of Windows 2003 resource kit tools

: repeat
robocopy X:\ Y:\From_X /MOVE /XD From_Y
if errorlevel 2 GOTO cont


: cont
robocopy Y:\ X:\From_Y /MOVE /XD From_X
if errorlevel 2 GOTO repeat

IF "%FIRST_OK"="1" GOTO end
GOTO repeat

: end
move X:\From_Y X:\
move Y:\From_X Y:\

See this link for errorlevel's returned by robocopy. 2 or higher means yet not done.

| improve this answer | |

You can do this with a shell script (powershell, bash).

L1 := files to move on disk a
L2 := files to move on disk b

while (L1 has files or L2 has files) and (l1 or l2 is true) 
   l1 := file from L1 that fits on b
   l2 := file from L2 that fits on a
   if l1
      move l1 to b
   if l2
      move l2 to a
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.