I'm attempting to port my diffdel.pl script for use on Windows. In this case on Windows 7 inside 64 bit Strawberry Perl.
I want something simple like this to actually work on Windows:
if ( ! -r "$File1" ) { $Debug && print "File $File1 is not readable!\n"; return 1; }
Unfortunately this doesn't work on Windows resulting in my script crashing due to Permission Denied trying to read a protected file.
Would someone please show me a code fragment on how to do this on Windows? I suspect it is going to be some kind of a Win32 ACL test but the details are evading me...
An example path with unreadable files where this keeps failing on Windows: C:\ProgramData\Microsoft\Crypto\RSA\MachineKeys\*
Edit: I may have figured a way around the need for this test. I'm simply going to blindly assume any error returned by the diff binary means the file is different. Ugly solution but it should work...
In reply to How to test if a file is readable on Win64? by rhardy
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |