Hi,
I know I can check for a directory if it exists or not using Directory.Exists(), but how can I check if a file exists?
Basically I want to do this:
1. check if a file exists at a given path
2. if the file exists, copy the file to another directory
Can someone help me with this?
I already have a collection of the fileNames stored in a DataTable.
DataTable dtFiles = DAL.GetFiles();
for(int x = 0; x < dtFiles.Rows.Count; x++)
{
DataRow dr = dtFiles.Rows[x];
// help me out to see if the file exists etc.
}

1 answers
Ok found a good tutorial on how to do this hehe.
<a target="_new" href="http://msdn.microsoft.com/en-us/library/system.io.file.exists.aspx">http://msdn.microsoft.com/en-us/library/system.io.file.exists.aspx</a>
File.Exists() is what I'm looking for (its in the System.IO namespace ofcourse)
answered 2 years ago by:
0
This post was imported from csharpfriends, if you have a similiar question please ask it again.
All previous members have been migrated, hope you enjoy the new platform!