• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 306
  • Last Modified:

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

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
kimmie8000
Asked:
kimmie8000
1 Solution
 
kimmie8000Author Commented:
if (File.Exists(path))
           
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now