Solved

File move blowing up because the parent directory sometime does not get cleaned.

Posted on 2010-08-24
1
271 Views
Last Modified: 2013-12-17
I need to know how make the following statement not blow up and go into the exception handler, when the file is stuck in the parent directory.

 File.Move(Path.Combine(targetDir, xmlFileName), Path.Combine(targetDir, xmlNewName));

What happens is the vendor is leaving the some of the files in the directory and on my Catch statement if the name is still there this blows up.

Since this program runs every five minutes I don't want to fill the event log with error messages.

How do I return the program without it blowing up?
0
Comment
Question by:kimmie8000
1 Comment
 

Accepted Solution

by:
kimmie8000 earned 0 total points
ID: 33513109
if (File.Exists(path))
           
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The object model of .Net can be overwhelming at times – so overwhelming that quite trivial tasks often take hours of research. In this case, the task at hand was to populate the datagrid from SQL Server database in Visual Studio 2008 Windows applica…
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question