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: $!";
  • Comment on Re: [Cygwin] Setting and getting file permissions as octal numbers
  • Download Code

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
    Since you indicate code from Linux is ok for you too.

    Just acknowledging publicly that this also worked flawlessly on my old Cygwin perl-5.14.4 (christ ... that is old) installation.

    Cheers,
    Rob