Click to See Complete Forum and Search --> : FTP complete folders


Nandy
08-10-2001, 09:00 PM
I made a script to ftp some files from a Sun Unix system to an nt pc. Everything worked fine while I was doing just files. Now I need to transfer complete folders. If I try: put /path/foldername, it gives me the following error: "/path/foldername : not a plain file." Being this of course allusive to the fact that I am trying to upload a folder. There must be a way to upload a directory. The following is the list of commands available on this particular ftp:
! cr macdef proxy send
$ delete mdelete sendport status
account debug mdir put struct
append dir mget pwd sunique
ascii disconnect mkdir quit tenex
bell form mls quote trace
binary get mode recv type
bye glob mput remotehelp user
case hash nmap rename verbose
cd help ntrans reset ?
cdup lcd open rmdir
close ls prompt runique

I can of course make a script to create the directory on the remote machine and then move the files from the local directory to the new directory on the remote machine. BTW the name of the directories is a combination of the day on which they were created and the heading of the file. This means the name of the directories change every day. Also this is the only ftp I can use so please do not offer as a help a "better" ftp program. I have to stick to what I have.

Thanks for your help,

Nandy

Arvoreen
08-20-2001, 11:08 AM
I'm pretty certain you're going to have to modify your script the recursively look for directories, create them on the remote FTP, and transfer the local files in those directories to the remote directory created. . .follow that? Hehe. As far as I know, there's nothing in the FTP protocol that will transfer a directory and its contents with one command.

Craig McPherson
08-29-2001, 12:56 AM
You can use mput for this.

Let's say you're in ~ on the local machine, and you have a directory called "temp" with 3 files in it.

You can use these FTP commands:

mkdir temp (the directory has to exist on the server)

mput temp/*

That should be all there is to it.

Craig McPherson
08-29-2001, 12:58 AM
Is this an expect script, by the way? Just curious.