Include timestamp with filename during moving the file

liunx

Guest
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 Rdim 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.I had tried the above expression without x. It displays an error "File is not exists".

Pls explain what is x?

Sivadim 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.
 
Back
Top