in reply to Checking for directory write permissions

Just use
if( not -w $dir) { die "directory $dir not writeable.\n"; }
The test -w works for files and directories. See perlfunc, -X (file tests).
_($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                              /\_¯/(q    /
----------------------------  \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}

Replies are listed 'Best First'.
Re^2: Checking for directory write permissions
by sara2005 (Scribe) on Jun 26, 2006 at 18:30 UTC

    Thanks a lot

    -w option worked!!

      Warning. The -w option will give you a misleading postive result in the case where you have permissions, but the partition is mounted read-only (popular for NFS on unix). We actually just wrote a quick function to test writeability by opening a file for write access wherever we were checking, and, if successful, deleting it afterwards. It was the only foolproof way we could come up with of detecting the situation.