Copy/Rename

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Lorider
Posts: 3
Joined: 30 Apr 2012 10:56

Copy/Rename

#1 Post by Lorider » 30 Apr 2012 11:01

Im looking for a way to copy 1 file chnage the name and place it in the same location.


So I.E. i have dat1.dat I want to copy it at dat2.dat, but if there is already a dat2.dat i want to delete dat2.dat and replace. i have yet to find a useful command to do that.

I also want to be able to reverse it. and go form dat2.dat to dat1.dat but i can create the seperate for that from revirse engineering thee first. I would appreciate the help. Im just using the bat for help in a game im creating using java. Im primarily a java/c++ programmer so i will greatly appreciate any help ypou can provide in this batch code.

Squashman
Expert
Posts: 4488
Joined: 23 Dec 2011 13:59

Re: Copy/Rename

#2 Post by Squashman » 30 Apr 2012 11:12

move /Y dat1.dat dat2.dat

Lorider
Posts: 3
Joined: 30 Apr 2012 10:56

Re: Copy/Rename

#3 Post by Lorider » 30 Apr 2012 11:23

Ty. i will test in a second. I am having a lil trouble on another side as I am working from a server and not directly form the computer. I am moving the folder im working in form the server to the computer to see if thats my issue. Again I appreciate the help.






After moving from the server. I am still having a problem that i get a message saying "The system cannot find the file specified." the file is in the same folder as the bat

Lorider
Posts: 3
Joined: 30 Apr 2012 10:56

Re: Copy/Rename

#4 Post by Lorider » 30 Apr 2012 11:28

Thank you I found the error. first off it was having trouble becuse the first time i ran it it just renamed the file and overwrote it. but deleted the original. so dat1 became dat2 and there was no dat1 after finishing. i changed move = copy and now it works. I appreciate the help. And I will contiue to come to this site for my batch help.

Post Reply