I want to copy a folder full of folders to a backup on another disk. But if a duplicate filename already exists on the other disk, I want Windows to prompt to ask whether or not to replace the file for each file separately.

Windows XP just gives me the option to replace all of the files or not copy the folder. Only if I copy only one folder will it prompt individual files. There are hundreds of folders in this structure, but less than 100 duplicate file names. But I don't know where the duplicates are, and do not know their filenames.

The problem is that I receive a lot of files submitted by students for grading. They are in a structure of subfolders named for the student name, all in a master folder on the assignment collecting system (which appears on my workstation as a drive). On each assignment due date, I want to copy the structure and files to identical folder structures of the work already received on two different hard disks. After I do this, I can click an icon to delete the files on the collection system but leave the structure. But there are always several cases where duplicate filenames arise, and I must manage each case separately.

  • A. The student submitted two different assignments at different times using the same filename.

  • A. The student modified the assignment file and submitted it again after I deleted the original.

  • B. The student submitted the same file again after I deleted it from the collection system.

  • B. I was unable to delete a file from the collection system earlier because it was open.

  • C. I received a partial copy of the file earlier because it was open.

In cases A, the new file must be renamed so both can coexist.
In cases B, the new file is deleted.
In cases C, the new file must replace the old one.

All I really need to do at copying time is deny the replacement when copying to one drive, and write down the file path. Then I can manage it later before copying the structure to the second drive and the file to the first drive.

As an alternative, I want a way that searches both sets of folders for duplicate names in the same place in both structures and reports them to me, so I can manage them before I do any copying.

Answers I do not want:
- Change operating systems - I don't control this
- Download or buy someone else's software - Not allowed
- A complicated system of - Must be easy for others to do
- Moving each folder separately - Can take hours
I give down points to these answers.

Recommended Answers

All 9 Replies

Unfortunately, unless you violate Answers #2 (download someone else's software) I can't help you; however, if you can install Cygwin (a Linux environment for Windows), then you can do this, and very easily. You would use the copy -ri dir1/* dir2 command/format which will copy all of the contents of dir1 into dir2, and ask you if you want to overwrite duplicate files (of the same name). This command (cp) is a standard part of cygwin (and Unix/Linux). It is a command-line function, and does not have a GUI component...

I do not have authority to install anything on the workstations.

There is a similar DOS function called xcopy that is installed. I will look into that.

Is there a way to make a call to it with a gui icon in XP?

I got it to work, but I have to use the DOS screen. This means that I have to do the bacvkups myself, because others can't just click and do it.

The command is:

xcopy j:/*.* k: /e /q /-y

If that command is doing just what you wish, then put it into a desktop shortcut.
Rclick desktop, New, Shortcut, paste in your command, Next to name it. Done.
A cmd window will flash, but that's hard to stop without using WSH.

Does it use the cmd window to ask about replacements, or does the Windows copy window apopear? The cmd window does not tell me the sizes or dates of the files.

Ah... of course, you want the copy dialogue for files existing in the target. So this is the cmd to put into your shortcut:

%comspec% /k xcopy.exe j:\*.* k:\ /e /q /-y

%comspec% will open the cmd window; the /k will keep it open after all copying is done so you can see the summary, else a /c will close the window immediately copying is over - you need one or the other.
I have put a \ after your target so that xcopy knows it to be a directory.
You don't actually need %comspec% to run xcopy.exe because it is an external command, but it will run it, of course, and it shows you the copying dialogue you require.

You can append commands in there, too, but you must be careful with syntax; a space or no in the wrong place and the string won't work. So:

%comspec% /k title Student Folders Updater & xcopy.exe j:\*.*" k:\ /e /q /-y

Now your window has a title, not just the command string it is executing.

I asked where the prompts for whether or not to replace will appear, not how to make the command window appear. The user will have to answer each prompt with Y or N.

Also, I need a way to see the sizes and file creation dates of the two files before each prompt, so I know whther or not to answer Y or N. The Windows copy a single folder provides that, but xcopy does not.

"Ah... of course, you want the copy dialogue for files existing in the target. So this is the cmd to put into your shortcut:"
And that was my answer to your request. Gee, just try it with some folders and files and a dummy target. But if you wish the dialogue to appear elsewhere than the cmd window then xcopy is not your command, and cmd is not the environment to use.
"Also, I need a way to see the sizes and file creation dates". Yes, possible with copy cmd, but you will need to invoke other commands to copy folders, and so a simple batch file will be required at the very least, and the dialogue will still appear in the cmd window.
Anyway, I was just following on from your mention of std Windows XP commands. Me, I'd use Richcopy and fully automate the process, no need to study individual overwrites. If you cannot/are not permitted to download that command from Technet then I cannot help further [it isn't supported by M$, but is written by one of their software engineers. Heck, it installs as Microsoft Richcopy]. It's pinned to my Start Menu; if drag n drop doesn't cut it [as it does not for you] then Richcopy gets the job. Runs on XP, is blindingly fast and can remember your task options.
Syncback also would work for you, present a list only of duplicates and their specific differences, and request actions.
Not much more I can offer. I don't care if you down-vote me for those answers. I don't give a hoot about such; it has no meaning for me.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.