Program to Check whether its a file or Directory

Discussion in 'ASP .Net' started by Stephen, Feb 15, 2006.

  1. Stephen

    Stephen Guest

    Hi all,

    Suppose I am monitoring a Folder C:\Temp
    and I drop either a file or directory into this folder

    How will i programmatically know whether the "item" dropped is a file or a
    folder

    Thanks,
    stephen
     
    Stephen, Feb 15, 2006
    #1
    1. Advertisements

  2. Stephen

    Mark Rae Guest

    Monitoring? You mean with the FileSystemWatcher...?
     
    Mark Rae, Feb 15, 2006
    #2
    1. Advertisements

  3. System.IO.FileInfo, check Attributes property, and then test Directory
    value...
     
    Ravi Ambros Wallau, Feb 15, 2006
    #3
  4. Stephen

    Stephen Guest

    Hi Mark,

    Yeah I am using FileSystemWatcher but I am trying another approach too...
    Suppose you have created an exe that uses path: C:\Temp and in this folder
    there are is a file or Directory, I want to see whether it a file or
    directory
    (just like java.io.File -> isFile, isDirectory)

    Hope I am presenting my idea,

    HI Ravi,
    I will take a look at FileSystemInfo.Attibutes


    Thanks all,
    Stephen
     
    Stephen, Feb 15, 2006
    #4
  5. Stephen

    Mark Rae Guest

    Oh right - Ravi has already answered this for you...
     
    Mark Rae, Feb 15, 2006
    #5
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.