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
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
LVL 56

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

Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

Question has a verified solution.

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

Being a system administrator some time we require to do things remotely, one of them is installing software. Here I am going to tell you how to install software through wmic (Windows management instrument console). I am not at all saying that this i…
ADCs have gained traction within the last decade, largely due to increased demand for legacy load balancing appliances to handle more advanced application delivery requirements and improve application performance.
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses

765 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