I need to clear the read-only flag of a file in my Perl program that runs on Windows.
I know system("attrib -r $filename") would work, but I was wondering if there is no built-in option in Perl to do it. chmod 777, $filename doesn't seem to work.
Thanks,
splintor
Try chmod 0777, $filename. You need the permissions in octal notation.
The most common way to handle this sort of thing is indeed with chmod. I was able to remove the read-only flag using the following with success:
chmod 0777, $filename;
This is using chmod's octal notation.
I'm using Strawberry Perl 5.8.8 on Windows Vista 64 bit.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With