Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2010-08-24
1
Medium Priority
?
301 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

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

Question has a verified solution.

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

Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Screencast - Getting to Know the Pipeline
Suggested Courses

783 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