Batch File Help

Locked
Kills On Site
Posts: 1741
Joined: Wed Jul 23, 2003 7:00 am

Batch File Help

Post by Kills On Site »

I am trying to write a batch file that will copy files from one location to another. The files will be overwriting files in the destination. Everything I try seems to not work. Any ideas?
[size=92][color=#0000FF]Hugh Hefner for President[/color][/size]
User avatar
Foo
Posts: 13840
Joined: Thu Aug 03, 2000 7:00 am
Location: New Zealand

Post by Foo »

You need some xcopy loving.

Give us the source and target folder names and we can write you a 1-line batch to do it. Unless its hideously complex.
Kills On Site
Posts: 1741
Joined: Wed Jul 23, 2003 7:00 am

Post by Kills On Site »

Well due to the sensitivity of the files, I can't divulge their true names and locations.

G:\file1.ext and G:\file2.ext need to both go to C:\Program Files\Program\Information\

I use quotations around the files and tried /Y, and /V, but they wont overwrite the file1 and file2 already in the Information folder.

The files from G: also need to be deleted after trasfer, but I can just use del G:\file1.ext
[size=92][color=#0000FF]Hugh Hefner for President[/color][/size]
User avatar
Foo
Posts: 13840
Joined: Thu Aug 03, 2000 7:00 am
Location: New Zealand

Post by Foo »

/R /Y and instead of using copy use xcopy.

That should fix it.

Y suppresses overwrite warnings.
R writes over read-only files.
Kills On Site
Posts: 1741
Joined: Wed Jul 23, 2003 7:00 am

Post by Kills On Site »

Foo, you are the batch god, you know that. Thanks for your help.
[size=92][color=#0000FF]Hugh Hefner for President[/color][/size]
User avatar
Foo
Posts: 13840
Joined: Thu Aug 03, 2000 7:00 am
Location: New Zealand

Post by Foo »

lies, I learned from guys with beards longer than my arm :D

Anytime.
Locked