SPUG: test directory and then create

Matt Tucker tuck at whistlingfish.net
Wed Jan 9 19:27:37 CST 2002


-- garrett esperum <shamonsflame at hotmail.com> spake thusly:

> Thanks For you help! I tried your example and it almost did the job.
> It successfully open and reads the external file. However it is not
> able to create any of the directories. This is the error message I
> recieve for the directory path one/two/three":
> 
> "Can't create directory: 'one/two/three No such file or directory."

This is because mkdir won't create parent directories. mkpath (from
File::Path), however, will. So you need a 'use File::Path' at the top,
and you need to change that mkdir to mkpath. Actually, you should
change it to 'mkpath $directory, undef, 0777 ^ umask', and get rid of
the $permissions variable.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 232 bytes
Desc: not available
Url : http://mail.pm.org/archives/spug-list/attachments/20020109/8535255b/attachment.bin


More information about the spug-list mailing list