in reply to Re^4: File Open Error = 13?
in thread File Open Error = 13?

get gets a file, not a directory.

Replies are listed 'Best First'.
Re^6: File Open Error = 13?
by molson (Acolyte) on Oct 28, 2009 at 21:37 UTC
    Right, but looking at the Perldoc info:

    get ( REMOTE_FILE [, LOCAL_FILE , WHERE] )

    Get REMOTE_FILE from the server and store locally. LOCAL_FILE may be a filename or a filehandle. If not specified, the file will be stored in the current directory with the same leafname as the remote file.

    If WHERE is given then the first WHERE bytes of the file will not be transferred, and the remaining bytes will be appended to the local file if it already exists.

    Returns LOCAL_FILE , or the generated local file name if LOCAL_FILE is not given. If an error was encountered undef is returned.

    Shouldn't it get the file from $directory and put it in c:\temp\ftp?

      shouldn't it get the file from $directory and put it in c:\temp\ftp?

      Sure, if you specified c:\temp\ftp\file as the local file name.

      You specified c:\temp\ftp as the local file name. The permission error you are getting are from attempting to overwrite a directory.

        Okay, I think I know where we are not understanding each other. In my code
        $ftp->get("$directory.thedir","C:\\temp\\ftp") || die "get failed ", $ftp->message;

        "thedir" is the name of my file. It's not the real name of the file but I should have used a better name in my example. Sorry about that.

        I have tried the following and still get the same error. The file does not have an extension.
        $ftp->get("$directory.thefile","C:\\temp\\ftp") $ftp->get("$directory.thefile","C:\\temp\\ftp\\thefile") $ftp->get("$directory.thefile","C:\\temp\\ftp\\thefile.txt")

        I didn't try them all at once but put them together here to save space.
        Okay, sorry about that. Will keep that in mind in the future.