joe_s has asked for the wisdom of the Perl Monks concerning the following question:
Example: ======= bshell6.0 > cat test.pl #!/opt/perl64/bin/perl my $file = $ARGV[0]; my $mode = (stat($file))[2]; print "File: $file\n"; print "mode = $mode\n"; printf "mode (octal) = %o\n", $mode; printf "Permissions = %04o\n", $mode & 07777; print "=============================\n"; bshell6.0 > ls -ldn testfile testdir drwxr-x--- 2 643 125 96 May 26 14:24 testdir -rwxr-x--- 1 643 125 0 May 26 14:24 testfile bshell6.0 > test.pl testfile File: testfile mode = 33256 mode (octal) = 100750 Permissions = 0750 ============================= bshell6.0 > test.pl testdir File: testdir mode = 16872 mode (octal) = 40750 Permissions = 0750 =============================
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Extract file type from stat() mode
by dragonchild (Archbishop) on May 26, 2005 at 19:16 UTC | |
|
Re: Extract file type from stat() mode
by brian_d_foy (Abbot) on May 26, 2005 at 19:22 UTC | |
|
Re: Extract file type from stat() mode
by ysth (Canon) on May 26, 2005 at 20:49 UTC | |
|
Re: Extract file type from stat() mode
by rlucas (Scribe) on May 26, 2005 at 19:29 UTC | |
|
Re: Extract file type from stat() mode
by polettix (Vicar) on May 26, 2005 at 20:50 UTC | |
|
Re: Extract file type from stat() mode
by Anonymous Monk on May 27, 2005 at 15:08 UTC |