Click to See Complete Forum and Search --> : Include timestamp with filename during moving the file


rskshiva
01-13-2005, 08:51 AM
Hai

In my console application, I am reading the files inside a folder and move them to another folder. I need to add the timestamp with the file name while moving the file from one location to another.

Ex:

File name: test.log
File name after moving it: test130501211011.log

I m not able to do this.

Suggest me.

Regards,
Siva R

Cstick
01-13-2005, 08:22 PM
dim filename as string = 'your filename

filename = filename.Insert(x.LastIndexOf("."), DateTime.Now.Month & DateTime.Now.Day & DateTime.Now.Year)


You can do something similar to that.

rskshiva
01-14-2005, 11:53 PM
I had tried the above expression without x. It displays an error "File is not exists".

Pls explain what is x?

Siva

Cstick
01-15-2005, 10:04 AM
dim filename as string = 'your filename

filename = filename.Insert(filename.LastIndexOf("."), DateTime.Now.Month & DateTime.Now.Day & DateTime.Now.Year)


Sorry bout that, should be filename as in above.