On Mon, 01 Jul 2002 09:26:25 +0200, Bart Lateur wrote:

>You must use FTP commands.

Whoops. I now see that you're actually asking a much simpler question.

You don't need a change the directory (with chdir()), you can open files
with a longer path just fine. You just must make sure that the path of
folders already exists before attempting to create the file -- and that
you're using the Mac convention for filepaths, using colons for a path
separator, for one. A leading colon allows you to create relative paths:

        :relative:path:to:a:file

File::Spec might take care of the dirty details for you.

Creating the nesting of the paths can be done in a loop:

        @dirs = split /:/, $path;
        pop @dirs;  # filename
        local $" = ":";
        for my $i (0 .. $#dirs) {
            mkdir "@dirs[0..$i]", 0755;
        }

Something along those lines.

-- 
        Bart.

Reply via email to