Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Creating new folders

by grep (Monsignor)
on Feb 03, 2008 at 03:13 UTC ( #665789=note: print w/ replies, xml ) Need Help??


in reply to Creating new folders

You should always test your file operations.

Try this:

if (!-d "e:/web/public_html/eagle_f91/ffinfo/protected/images/$Game") +{ mkdir("e:/web/public_html/eagle_f91/ffinfo/protected/images/$Game" +) or die("$!\n"); } if (!-d "e:/web/public_html/eagle_f91/ffinfo/protected/images/$Game/$S +ubSet") { mkdir("e:/web/public_html/eagle_f91/ffinfo/protected/images/$Game/ +$SubSet") or die("$!\n"); } if (!-d "e:/web/public_html/eagle_f91/ffinfo/protected/images/$Game/$S +ubSet/thmb") { mkdir("e:/web/public_html/eagle_f91/ffinfo/protected/images/$Game/ +$SubSet/thmb") or die("$!\n"); }
$! will show you the specific error message.

UPDATE: fixed typo

grep
One dead unjugged rabbit fish later...


Comment on Re: Creating new folders
Download Code
Re^2: Creating new folders
by Eagle_f91 (Acolyte) on Feb 03, 2008 at 03:53 UTC
    Thanks I had forgoten about the die command, but in this case it did not help.
      It's not really the die that's important. It's the test of file operation and the printing of $!. You could just as easily write:
      if (!-d "e:/web/public_html/eagle_f91/ffinfo/protected/images/$Game") +{ mkdir("e:/web/public_html/eagle_f91/ffinfo/protected/images/$Game" +) or print "$!\n"; }
      If there's an error it should populate $!, that error message will tell you what went wrong (generally). So it should either work or give you and error. So it has to help.

      grep
      One dead unjugged rabbit fish later...

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://665789]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (18)
As of 2014-10-30 14:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (208 votes), past polls