Gossamer Forum
Home : General : Perl Programming :

How do I make a directory in perl?

Quote Reply
How do I make a directory in perl?
How do I amke a directory in perl?
Quote Reply
Re: How do I make a directory in perl? In reply to
According to perldoc:

Quote:
mkdir FILENAME,MODE

Creates the directory specified by FILENAME, with permissions specified by MODE (as modified by `umask'). If it succeeds it returns TRUE, otherwise it returns FALSE and sets `$!' (errno).

In general, it is better to create directories with permissive MODEs, and let the user modify that with their `umask', than it is to supply a restrictive MODE and give the user no way to be more permissive. The exceptions to this rule are when the file or directory should be kept private (mail files, for instance). The perlfunc(1) entry on `umask' discusses the choice of MODE in more detail.

An example would be:

Quote:
if (mkdir ("/path/to/new/directory", "0755")) {;

I hope this helps.

[This message has been edited by Bobsie (edited May 27, 1999).]
Quote Reply
Re: How do I make a directory in perl? In reply to
cool!

Thanks for your help. I needed this last bit to finsih up a huge scripts.

Thanks again,
Vivitron