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: Help with bat file (xcopy) on Win7

05 Mar 2011   #1
BobWinMan

windows 7 32bit
 
 
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 newer than those on the USB and it overwrites them. On Win7, it creates multiple folders (with the same name) each time you run it. So, after running it four times, there are four "holder" files on the USB.

Any idea why it does this and/or how to correct it?


My System SpecsSystem Spec
.
05 Mar 2011   #2
Kari

 

Hi Bob, welcome to the Seven Forums.

Try Robocopy instead of Xcopy. More here: Batch file copy made easy

Some examples of using Robocopy can be found in this thread.

Kari
My System SpecsSystem Spec
05 Mar 2011   #3
Ztruker

Windows 10 Pro X64
 
 

Try adding /i, see if that makes a difference.
My System SpecsSystem Spec
.

06 Mar 2011   #4
BobWinMan

windows 7 32bit
 
 

Quote   Quote: Originally Posted by Kari View Post
Hi Bob, welcome to the Seven Forums.

Try Robocopy instead of Xcopy. More here: Batch file copy made easy

Some examples of using Robocopy can be found in this thread.

Kari
Thanks... that's an option but I'm trying to keep it consistent across platforms and Win2003 doesn't have robocopy.
My System SpecsSystem Spec
06 Mar 2011   #5
BobWinMan

windows 7 32bit
 
 

Quote   Quote: Originally Posted by Ztruker View Post
Try adding /i, see if that makes a difference.

The /i doesn't look like it has the intended purpose... but I can give it a shot.
My System SpecsSystem Spec
Reply

 Help with bat file (xcopy) on Win7




Thread Tools




Similar help and support threads
Thread Forum
Xcopy File Not Found Error
I'm trying to copy my reg back ups to override my current registry. I am doing this in the boot disk cmd. It is telling me File Not Found - RegBack even though I clearly have a folder called it that I am changing my directory to. cd \windows\system32\config\regback xcopy...
Backup and Restore
XCOPY "File not found - *" Error
I have attached a few images. This is a transfer between xp and 7. The My Videos folder does not exist in this instance but the others do and they do have files in them. What is going on here?
General Discussion
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
Created a scheduled .bat file to xcopy. How do I?
I've created a bat file to run on a schedule to backup stuff. How do I make the taskeng.exe gui not appear?
Customization
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
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?
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 12:16.
Twitter Facebook Google+ Seven Forums iOS App Seven Forums Android App