Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Recursive directories

by cord-bin (Friar)
on Apr 02, 2014 at 12:25 UTC ( [id://1080763]=note: print w/replies, xml ) Need Help??


in reply to Recursive directories

File::Path->make_path is used to make a path, so you should define your $path before. If you try:

use File::Path 'make_path'; $path = '/'; File::Path->make_path($path); chdir $path or die "Cannot chdir: $!";

it will work and it does for me

To get the path you can do something like:

use File::Path 'make_path'; use Cwd; $path = Cwd::getcwd; File::Path->make_path($path); chdir $path or die "Cannon chdir: $!"; print $path. "\n":

Replies are listed 'Best First'.
Re^2: Recursive directories
by McA (Priest) on Apr 02, 2014 at 12:56 UTC

    Hi,

    be careful. You probably get what you don't want. Jenda explained it very nice. When you do the following assuming you have the correct rights:

    use File::Path 'make_path'; File::Path->make_path('huhu');

    you create two directories: File::Path and huhu. Try it with:

    File::Path->make_path('huhu', { verbose => 1});

    after removing the newly created directories in you test cwd.

    McA

      Yes, you are right, it indeed created in a strage way two folders and is not what I meant as I didn't want the directory File::Path. Good to know, thank you for your point!

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (5)
As of 2024-04-25 15:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found