Click here to Skip to main content
15,894,017 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am using the DownloadFile method of WebClient to read in an XML file from a URL and write it out to a local drive for import into another system.

I need to append the date selected to the filename. My problem is that I can not figure out how to deal with the quotes and the backslash in the file name.

The file name should end up looking like: @"c:\fileout_08112010.xml"

The entire statement currently looks like:
wc.DownloadFile(inURL, @"c:\fileout_08112010.xml");

Any ideas or hints and especially direct knowledge would be very much appreciated!

Thanks!
Posted

1 solution

It looks like you are using C#. In that language, backslashes and quotes must be escaped by preceeding them with a backslash. So, your file name would look like @\"c:\\fileout_08112010.xml\". Otherwise, C# will treat the quote as a delimiter and the backslash + f as a single escaped character.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900