Results 1 to 2 of 2

Thread: FileInfo Question - Spaces in filename

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jun 2001
    Location
    Viet Nam
    Posts
    98

    FileInfo Question - Spaces in filename

    Hello all,

    I have a file (ex File.txt) placed in My Documents folder.
    I wrote below code:
    Code:
    FileInfo f = new FileInfo(@"C:\Documents and Settings\huyho\My Documents\File.txt");
    if (f.Exists) 
    {
               //............. do something
    }
    the property Exists always return false. I think the problem is the spaces in filename. But dont know how to solve this.

    Anyone can help me?

    Thanks

  2. #2
    Hyperactive Member Sgt-Peppa's Avatar
    Join Date
    Mar 2003
    Location
    Munich - Germany
    Posts
    476
    This returns true for for me?
    Code:
    FileInfo f = new FileInfo(@"C:\Dokumente und Einstellungen\Peppa\Eigene Dateien\test.txt");
    Console.WriteLine(f.Exists.ToString());
    Console.ReadLine();
    So it seems like its not the whitespaces. Problem must be somewhere else.

    Stephan
    Keep Smiling - even if its hard
    Frankie Says Relax, wossname Says Yeah!
    wossname:--Currently I'm wearing a gimp suit and a parachute.
    C# - Base64 Blog

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width