1.

Solve : Dos Copy Command?

Answer»

I had a large home server with three drives full of data set up in a Raid configuration that spread out the data over three disks such that 1/3 of the data was RECOVERABLE from each disk. I have all three disks and have saved most of the data from the crashed disk. I need to copy all of this data onto my new server. The data is distributed among various folders and subfolders - several thousand in fact and about 2000000 files. I want to transfer this data to the new server from the old drives without deleting or overwriting existing data that may have been duplicated between drives.


So, for example, I have a a bunch of files, folders, and subfolders in "C:/Geographicus/Maps/" These subfolders (which also CONTAIN subfolders) are labeled as "1805 Thomson", " 1723 Homann", "1823 Mitchell", etc. I want to write a copy command that copies all of the folders and subfolders and the files they contain to a folder on the new network drive. However, the drive is already populated with other folders, so I don't want it to overwrite what I have, just ADD to it. Moreover, I want to use a wildcard such that all of the folders that start with 18* go in a folder labeled 1800s, all of the folders that start with 17* go in a folder labeled 1700s, etc... TO make this easier I have mapped each of these network folders to a drive letter, so 1800s might be drive x:, etc.

I can easily do this with windows, but the problem is there are so many files that it crashes my computer each time I try. Dos can handle it easily without eating up system resources.

Can any help me to FORMAT this command using copy, robocopy, or xcopy?

KevinLet me rephrase what I think your hardware is currently at:

You have two sets of storage and you want to copy all the files from one set to the other, but to skip files which already exist. Yeah?

I assume they both have drive letters. This is untested but should be run from the root of the source drive.
The target is set to the drive letter of the target array.

It will merely echo the xcopy command to the screen and pause for each file. If it looks ok the remove the 'echo' and the first 'pause'

Code: [Select]@echo off
set target=D
dir /a-d /b /s >temp.list
for /f "delims=" %%a in (temp.list) do (
echo if not exist "%target%:%%~pnxa" xcopy "%%a" "%target%:%%~pa"
pause
)
pauseSort of. Essentially I want to consolidate three similar but not identical drives to a single network drive. Some of the files and folders exist on each of the three drives. So, Folder A on drive A may have 100 folders and 1000 files. The same folder A on drive B may have 75 folders & subfoders, and 750 files, some of which will be the same, some of which wont. So, I just want to copy the files and folders & Subfolders that don't exist on the B drive from the A Drive. In the end I will have the full data set is on the B Drive.

With widows this is easy, because it asks me if I want to merge folders (yes) and overwrite files (no). With DOS the copy system is more robust, but confusing for a novice.

The second element of this was that initially all of the main folders, perhaps 1000 were in one directory. But its too many, so now I want to split them into multiple directories based on the folder name which contains them. So if the folder name starts with 18, then I can move the folder and its contents to a subfolder on the network labeled 1800s. I can do the same with folders that start with, 15, 16, 17, etc... I will need to do this with each of the three drives to get all files on the network. I can only attach one of the three drives to the computer system at one time but the destination drive - the network is attached. I have successfully transfered one drive to the network, now I need to get the other two over.

I am not sure, but it does not look like this program will address all concerns, only some.

Kevin


Kevin
Kevin, it is meant to copy all the files that don't exist, from the drive it is run from. Copy it to the root and run it.

The moving of folders and files is best done once you have a full copy of the data, and you will have to give a better description of how you want the folder/trees moved, with a short list of examples.

I gather you have a folder with subdirectories like this:

18abc - def
18man in the middle
18ten green bottles
15how about a coffee
15hard drive 123

and you want them in folders like this:

1800\18abc - def
1800\18man in the middle
1800\18ten green bottles
1500\15how about a coffee
1500\15hard drive 123

Is that right?Exactly
Don't come back and say "Well, it's not quite what I want..."

Test this on copies of your data - it is designed to be run inside the folder where you want the folders sorted.

Code: [Select]@echo off
for /f "delims=" %%a in ('dir /ad /b') do call :next "%%a"
goto :EOF
:next
set "var=%~1"
md "%var:~0,2%00" 2>nul
move %1 "%var:~0,2%00"Thanks, I look forward to trying it as soon as I consolidate the data with the other program!

Kevin



Discussion

No Comment Found