I'm still on Perl v5.8.8. I was writing an app today that needs to
create a sub directory if it does not already exist.
 
Originally, I used  mkdir( <path> ). Notice that there is no 2nd arg.
After I did this, the app copies a bunch of files into that sub
directory, which works fine. HOWEVER, when the same app tries to write
newer copies of the same files (named the same), I get a "permission
denied" error.
 
So I changed the app by setting the umask, and also specifying a
permissions mask in the mkdir function (see below). I deleted the sub
directory and ran the new app. Now the sub directory seems to be wide
open, but when you click on the directory and check properties, it has
Read Only checked!
 
I am uncomfortable using unix permission masks on a Windows machine, but
at the same time I would rather not load a module for such a simple
thing.
 
Does anyone have advice for me about how they create directories with
Perl?
 
Barry Brevik

=====================================
use strict;
use warnings;

umask 0;

my $thisPath = "c:\\temp\\megabom\\newdir";

unless (-d $thisPath) {mkdir $thisPath, 0777;}

if (-r $thisPath) {print "  Sub folder is read for everyone.\n\n";}
if (-w $thisPath) {print "  Sub folder is write for everyone.\n\n";}
if (-x $thisPath) {print "  Sub folder is execute for everyone.\n\n";}
_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to