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 John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using the copy command recursively and to overwrite. 2

Status
Not open for further replies.

stla

IS-IT--Management
Mar 12, 2003
190
DE
I would like to write a small script (.bat file)that would copy the contents of a folder (files and sub-folders) to a network volume.

My script is copying the files but not the sub-folders and is overwriting existing files without prompting.

Am I corrct in thinking it is missing a recursive command?

Can anyone help me with the syntax?

copy /Y C:\data\test\* D:\backup\test\

Best regards
 
i use a batch file to backup my stuff att work from the local machine to a network location. the command looks like this:
Code:
[b]xcopy "C:\Documents and Settings\levym\My Documents\*.*" u:\mydocs\*.* /e /h /y[/b]

this backs up all folders/subfolders and files, and overwrites without prompting.

Then it displays an ASCII pic of the cookie monster! :)



------------------------------------------------------
Matt
He's not the messiah, he's a very naughty boy
 
The /Y in your command tells copy to overwrite without prompting. If you want it to prompt then remove the /Y. You would be better off with xcopy as Scotsdude says or Robocopy (free from Microsoft).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top