469,593 Members | 2,057 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,593 developers. It's quick & easy.

Problem with File.Exists() method.

I am attempting to copy some files from one machine to
another. I am having difficulty with the File.Exists()
in the code below. The program enumerates the files in a
directory, checks them against a cuttoff DateTime, and
copies them if thet do not already exist. All progress
is written to a log (a snippet is included below the
code). The File.Exists() method returns false even when
the file does in fact exist. Have I coded this

P.S. This code seems to work on my XP test box, but when
I copy it to the production machine running Windows 2000
server, it fails.

for(int i=0; i < sourceFileArray.Length; i++)
cutoffTime) < 0)
string destinationFilePath = destinationDir.FullName
+ @"\" + sourceFileArray[i].Name;

("DEBUG",destinationFilePath, Convert.ToString(File.Exists

sourceFileArray[i].Name, "Sucessfully copied log.");
catch (System.Exception e)
(true, "LOGCOPY", sourceFileArray[i].Name, e.Message);


DEBUG <some filepath> 10/20/2003 1:55:53 PM
ERROR LOGCOPY <some filepath> 10/20/2003 1:55:53 PM
The file <some filepath> already exists.
Jul 21 '05 #1
0 1232

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by StGo | last post: by
10 posts views Thread by Michael Murphy | last post: by
reply views Thread by Tim Richardson | last post: by
6 posts views Thread by TPJ | last post: by
reply views Thread by suresh191 | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.