in reply to File Find permissions check

Why do you want to execute a directory? On *nix, you need execute permissions on a directory in order to scan its contents. On WinNT (IIRC), the file scan permission on directories is a seperate attribute.

There might be a module in the Win32:: namespace that could help you (perhaps Win32API::File?), but I don't deal with Win32 programming enough to help you there.

----
I wanted to explore how Perl's closures can be manipulated, and ended up creating an object system by accident.
-- Schemer

Note: All code is untested, unless otherwise stated

Replies are listed 'Best First'.
Re: File Find permissions check
by Abigail-II (Bishop) on Jul 07, 2003 at 14:20 UTC
    To "scan" the content of a directory under Unix, you need execute *and* read permission. Execute permission gives you the ability to make it your current working directory, and to access files in that directory. You can't get a listing with just execute permission.

    Abigail

Re: Re: File Find permissions check
by Anonymous Monk on Jul 07, 2003 at 14:12 UTC
    I really only need to check if I have read or write permissions on the directory not execute permissions.
      Pardon me in advance, fellow monks!
      I know it's ugly and just a terrible hack... but, personally, if I have to get the job done and -r is not reliable, I wouldn't mind that much trying
      if(!opendir(DIR,$startDir)){ # ... }else{ closedir(DIR); }

      Finding, installing, testing a module for doing just that seems a bit of an overkill... just my 0.02euros, as usual.
        thanks it now works. Question about adding "exit" command. If I add it in the below area will it be a problem because I am exiting without doing the "closedir(DIR)" filehandle??
        PLease advise if this is okay??
        if(!opendir(DIR,$startDir)){ print "No permission to open directory $startDir\n"; exit 0; }else{ closedir(DIR); }