How do I amke a directory in perl?
May 27, 1999, 3:49 PM
Veteran (3108 posts)
May 27, 1999, 3:49 PM
Post #2 of 3
Views: 432
According to perldoc:
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:
I hope this helps.
[This message has been edited by Bobsie (edited May 27, 1999).]
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).]

