in reply to [Cygwin] Setting and getting file permissions as octal numbers
Since you indicate code from Linux is ok for you too:
use warnings; use strict; use File::stat; use Fcntl qw/S_IMODE/; my $filename = $0; # just for testing my $stat = stat($filename) or die "stat $filename: $!"; my $perms = S_IMODE($stat->mode); printf "%#0o\n", $perms; chmod $perms, $filename or die "chmod $filename: $!";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: [Cygwin] Setting and getting file permissions as octal numbers
by syphilis (Archbishop) on Sep 04, 2022 at 10:18 UTC |