Using XXCOPY in DOS Batch File, And...

Posted on 2010-01-12
Medium Priority
Last Modified: 2012-05-08
I am using xxcopy right now to move files that are a year and older to another location.  It retains the directory structure at the source and creates it correctly at the destination.  It successfully moves the files from source to destination based on the file creation date.  It also retains the directory structure.  That's great!  
However, I have not been able to figure how I set it up so that if the file with the same name exists on both the source and destination to not overwrite the destination but simply rename the file and move it in the same location.  For example, if a file is named " test.txt", and it exists within the same directory at both the source and destination it should not overwrite the destination file test.txt and simply rename the file at the destination as test1.txt or test-1.txt, etc.  So I need to retain the different file versions without simply overwriting them.  
Question by:cmp119
  • 3
LVL 59

Accepted Solution

Bill Prew earned 2000 total points
ID: 26299562
Have you tried the /JV option, that is it's purpose?  If you have and it isn't working, can you share the actual XXCOPY command, and describe what the results were.


Author Comment

ID: 26303073
I need to check into it.  I never saw it.  I believe this will do the trick though.  Thanks

Author Closing Comment

ID: 31676407
The switch did the trick!!!

Author Comment

ID: 26345790
Your answer was on the money, but now the problem became more complex.  I need to be able to move a given direcory only if "all" the files with the directory or subdirectories are older than a given date.  If a a single file within the directory or subdirectories is not older than the specified date, then the folder should not be moved.  I do think xxcopy can handle this and I am investigating...  Do you have any idea?

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Numerous times I have been asked this questions that what is it that makes my machine log on so slow, there have been cases where computers took 23 minute exactly after taking password and getting to the desktop. Interesting thing was the fact th…
I've always wanted to allow a user to have a printer no matter where they login. The steps below will show you how to achieve just that. In this Article I'll show how to deploy printers automatically with group policy and then using security fil…
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Enter Foreign and Special Characters Enter characters you can't find on a keyboard using its ASCII code ... and learn how to make a handy reference for yourself using Excel ~ Use these codes in any Windows application! ... whether it is a Micr…

621 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question