How to tell if file is DIR or FILE?

  • Alex

    Alex - 2011-11-25

    Hi there! I'm a bit new to SourceForge and programming in general, so this might be a stupid question,
    but how would you find out if the deleted file was a directory or a file?

    My usual approach is to make a new File object with the given pathname, but obviously this won't work since
    the file is deleted. Any help would be very much appreciated!

    Oh, and thanks for the great library! It's really quite easy to use. :)

  • Alex

    Alex - 2011-11-25

    (Can't seem to find an edit button? So doubleposting it is)

    A little edit: making a File object will work, but the methods isFile() and isDirectory() will always return false, because the file does not exist on the filesystem.

  • Xavi

    Xavi - 2011-11-30

    I think you can make a list  of  Directories (or files) when your program starts and update that list after every 'new' event. Then when a file/directory is deleted check that list.


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks