954,566 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Copy file with a name change

ola

I need to copy a file from one directory on my server to another. The thing is, if the file already exists in the destination folder, I need to copy it with a different name (i'd just like to add a 2 or something to the end of the fileName).

Is there any way to copy a file AND change the name?

AndrewSmith
Newbie Poster
11 posts since Jul 2006
Reputation Points: 10
Solved Threads: 0
 

Alright, I solved it. Turns out you can just put the name of the file right there in the copyFile line.
looks like this:

fs.CopyFile sourceFile, DestinationFolder & "\NEWFILENAME.txt", 1


Next time i'll look around a bit more before posting.
Rock on.

AndrewSmith
Newbie Poster
11 posts since Jul 2006
Reputation Points: 10
Solved Threads: 0
 

hey andrew,

Try this,


save the file name with a unique no.

and the unique no. is

day() & month() & year() & hour() & min() & second()

thanks,
Chaitanya.

chmonalisa
Light Poster
26 posts since Sep 2006
Reputation Points: 11
Solved Threads: 1
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You