Windows 7 Forums

Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: Need xcopy script help

20 Apr 2011   #1
cvaughn8086

Windows 7 Ent 32 bit
 
 
Need xcopy script help

I'm looking for a script that will allow me to copy and "overwrite" all files with a date and time stamp BEFORE a certain date. The source files will NOT be deleted and all permissions will stay the same in destination directories. Copy does include subfolders as well. Any ideas?


My System SpecsSystem Spec
.

20 Apr 2011   #2
mrdemon

Windows 7 Home Pre
 
 

Robocopy - Wikipedia, the free encyclopedia

I think this is what your looking for.
My System SpecsSystem Spec
20 Apr 2011   #3
cvaughn8086

Windows 7 Ent 32 bit
 
 

Thanks, but I don't believe robocopy will "overwrite" files with the same date and time stamp. I will be copying identical files and need to overwrite those files. The issue however is that I only want to overwrite files with a date and time stamp before 4/16/2011. From what I understand, xcopy will actually overwrite the files.
My System SpecsSystem Spec
.


20 Apr 2011   #4
mrdemon

Windows 7 Home Pre
 
 

Then in that case, MS-DOS xcopy command help and learn it. Its simple to do a batch code in txt doc and change too .bat and run it.
My System SpecsSystem Spec
20 Apr 2011   #5
FliGi7

XP / Win7 x64 Pro
 
 

Why don't you just sort the files by time and only copy over/overwrite the ones over that are prior to the particular date and time?
My System SpecsSystem Spec
20 Apr 2011   #6
SIW2

Microsoft Community Contributor Award Recipient

Vista x64 / 7 X64
 
 

Copy files changed on or after the specified date:

xcopy Source [Destination] [/d[:mm-dd-yyyy]]

Copy only files with date/time more recent than destination date/time:

xcopy Source [Destination] /D

/R overwite read only

/Y don't prompt for overwrite
My System SpecsSystem Spec
20 Apr 2011   #7
FliGi7

XP / Win7 x64 Pro
 
 

This should work for you:

Code:
robocopy /COPYALL /IS /MINAGE:20110415
/COPYALL : Copy ALL file info (equivalent to /COPYATSOU).
/MINAGE:n : MINimum file AGE - exclude files newer than n days/date.
(If n < 1900 then n = no of days, else n = YYYYMMDD date).
/IS : Include Same, overwrite files even if they are already the same.
My System SpecsSystem Spec
20 Apr 2011   #8
FliGi7

XP / Win7 x64 Pro
 
 

Quote   Quote: Originally Posted by SIW2 View Post
Copy files changed on or after the specified date:

xcopy Source [Destination] [/d[:mm-dd-yyyy]]

Copy only files with date/time more recent than destination date/time:

xcopy Source [Destination] /D
The first is only checking dates and times of the source file and it sounds like he want to replace based on destination date/time.

The second only checks the source date/time against the destination date/time and not a specified date/time, should this be different.
My System SpecsSystem Spec
Reply

 Need xcopy script help




Thread Tools





Similar help and support threads
Thread Forum
xcopy comes up with 'file not found'
I am just trying to get this simple script i wrote to work in a batch file, but when I run the file, in the cmd screen, it comes up with; File not found- Backup 0 file(s) copied This is the script I use; @Echo Off xcopy /s "c:\Users\Jacob Smith\Desktop\Server\world d:\Users\Jacob...
General Discussion
Meaning of Parameters in the XCOPY command
I'm trying to create bootable flash drives. At one point, I'm told to use the command, xcopy f:*.* /s/e/f hg: in which f: is the source, g: is the destination. Why am I told to type, "hg:"? What does the "h" do? When I enter the command, Windows 7 asks me if g: refers to a file or a...
General Discussion
Xcopy cannot create directory
My backup cmd file has been in use since XP, through Vista to Win7. It has worked on a new laptop in Win7 ever since Win7 was released. Recently it has stopped working getting an access denied, cannot create directory message. It is xcopying my own folders, not the default documents etc. In a cmd...
General Discussion
Access Denied Permissions Gone due to XCOPY
I used xcopy in an admin cmd prompt, just as a test to learn how to use it. I asked it to copy a small directory from one HDD to another. It did but now the entire partition on the destination drive is locked - "Access Denied." I didn't add anything crazy to the xcopy switches though I did...
General Discussion
Batch file & XCopy
I hope this is the correct forum?? I have a small network with 2 XPs and 1 Win7. The Win 7 PC recently replaced on older XP PC. I have been backing up accounting data from one XP to another XP using a DOS batch file that uses the XCopy command and this has been working fine for several years....
Network & Sharing
Help with bat file (xcopy) on Win7
I have a batch file that copies some files from a win7 hard drive to a USB stick. Sample code: mkdir G:\holder xcopy C:\users\me\documents\sub\*.*/s/e/h/r/y/D G:\holder\*.* This file works fine on any previous version of MS Windows to copy all the files in the targeted directory that are...
General Discussion

Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 10:43.

Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App