Link to home
Start Free TrialLog in
Avatar of Bala Venkat
Bala Venkat

asked on

Filename to be appended with DateTimeof Download

Hi Experts,

I had this question after viewing FileInfo MoveTo problem.

The Answer given to the question asked in the above link was great, I encountered the similar problem and that solution worked like a charm. It would be great if someone can help me out on the method to append DateTime of the file download to that same piece of code. Since I use the code to download that particular file every Friday.! So I encounter System IO Exception:: File already Exists Error. When I do the second friday

Suggestions/Ideas most welcome

Regards,
BalaV
Avatar of AndyAinscow
AndyAinscow
Flag of Switzerland image

Add the current date (or whatever you want) to the name.  I'm using the solution line in the link.
Something like:
fieach.MoveTo(System.IO.Path.Combine(destinationDirectory, fieach.Name + DateTime.Now.ToString("yy.MM.dd")));
ASKER CERTIFIED SOLUTION
Avatar of AndyAinscow
AndyAinscow
Flag of Switzerland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Bala Venkat
Bala Venkat

ASKER

Hi Andy,

       Thanks much for the Instant Help. Your Suggestion works well as expected.

Regards,
BalaV