Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MKDIR error

Status
Not open for further replies.

jray2003

Programmer
Aug 12, 2003
253
US
I am doing the following to create a directory on a Windows machine and eveytime I do, I creates it as "READ ONLY". I thought by putting the 0777 makes it writeable? What am I doing wrong here?

Thank you

Jim

Code:
    print "$DestFile does not exist - \n";
    mkdir $DestFile, 0777 or die "can't create $DestFile: $!";
    print "Created Directory\n";
 
0777 are unix permissions.
What Windows OS?
--Paul

Spend an hour a week on CPAN, helps cure all known programming ailments ;-)
 
Windows XP or will be running on any WINDOWS enviroment.

Thanks
 
First off 0777 makes the directory readable, writeable and executable by any account on the unix box, not a good idea.

The process that creates the directory is the owner so less permissions is a much better idea, but that's for another day, it's not you issue here

try this
Code:
#!c:/Perl/bin
 mkdir "fred" or die $!;
 open FH, ">fred/fred.txt" or die $!;
 print FH "This worked!!!";
 close FH;

This will create a directory "fred", and a file "fred.txt" in that directory. I tried this on an XP box, and the readonly flag is "vague", it's neither checked, nor unchecked, but you can still create files in it

HTH
--Paul

Spend an hour a week on CPAN, helps cure all known programming ailments ;-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top