Question

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

Was it helpful?

Solution

Try chmod 0777, $filename. You need the permissions in octal notation.

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top