Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

automatically replace duplicate files 1

Status
Not open for further replies.

k33

Technical User
Apr 10, 2003
20
0
0
US
I have a script that moves data from one file into several other files. Once in awhile, the script displays a dialog box stating that a file with the same name already exists and do I want to replace it? I do not want this window to come up. If their is a duplicate file, I would like to have the script append the name of either the original or duplicate. Any ideas? Here is a portion of the code that copies/moves. The important thing is that no window appears, that it is all done automatically.

oSHApp.Namespace(holding).MoveHere datapath, FOF_FILESONLY
oSHApp.Namespace(download).MoveHere datapath, FOF_FILESONLY

(and a few .CopyHere in the same format)

Thanks
 
the script append the name of either the original or duplicate
Can you elaborate please with samples ?

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Do you need examples of appending the duplicate files?
if so, it can be as simple as
abc.txt / abc_1.txt or I can have the duplicate files sent to a folder "duplicates". There should never be a duplicate file name, but I need to have this feature built in, just in case (it has happened 2x). If you were requesting a different sample, please let me know and thanks for the quick response.
 
Sorry, reread the subject, so try this:
oSHApp.Namespace(holding).MoveHere datapath, FOF_FILESONLY[highlight], 16[/highlight]

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Sorry, I reread my subject heading. The only files that have duplicate file names, are indeed duplicate files and should not be replaced or renamed, any duplicate files should automatically be disregarded.
I tried adding the 16 to the end, but I still get a pop-up window asking if I would like to replace the file.
 
I ended up changing FOF_FILESONLY to FOF_NONCONFIRMATION. This appears to have solved the problem, as would adding a 16. Thanks for all your help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top