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?

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.

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.