Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: [Cygwin] Setting and getting file permissions as octal numbers

by haukex (Archbishop)
on Sep 03, 2022 at 15:33 UTC ( [id://11146661]=note: print w/replies, xml ) Need Help??


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
    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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11146661]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (5)
As of 2024-03-29 13:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found