Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

looking to ftp multiple files

Status
Not open for further replies.

SaltyDuke

Programmer
Sep 18, 2002
140
0
0
IE
hello!

i'm not sure if this is the right place for this thread. if not, sorry! :)

anyway, i have a few thousand text files on one network and i'm looking to use ftp to move them across to a server on another network. there is only one machine connected to both networks, and this pc will be used for the operation.

(up until now, i've only ever had to transfer one file at a time, but now i've been given 1000's of them! :-()

luckily, all the files have the same extension, so i thought it would be something like this:

ftp
open xxx.xxx.xxx.xxx
UserName
********
bin
hash
put *.pinf /usr/dir/*.pinf
bye

when i run this, i only copy one file, called *.pinf !!! is there a way to automate the file transfer process?

thanx in advance for any suggestions
TheSaltyDuke

[pipe]
 
In your script, turn prompt off
Then use mput (multiple put)
 
thanx for the help.

it seems to be working a treat! :)

[pipe]
 
oops! it seems i spoke too soon

when i use the following script:

ftp
open xxx.xxx.xxx.xxx
UserName
********
bin
hash
prompt
mput *.pinf /usr/dir/*.pinf
bye

it appears to get all the files (i see "Transfer Complete", "800 bytes sent" etc), but then it tells me:
"/usr/dir/*.pinf: File Not Found"

do i have the syntax of the mput command correct?

thanx for any help
TheSaltyDuke

[pipe]
 
To get correct ftp syntax, do a 'man ftp'. You might also need to add a command line option (-i if I'm not mistaken) to not receive a prompt after each file when using mput.

 
mput *.pinf /usr/dir/

it will maintain the filename. (NB tested under suse 8.0 / bash...can't say for other distros tho!)

<marc> i wonder what will happen if i press this...[pc][ul][li]please give feedback on what works / what doesn't[/li][li]need some help? how to get a better answer: faq581-3339[/li][/ul]
 
Are you using the right command ? ie. mput or do need to use mget?

mput will send the files to the machine you are FTP'ing to where as mget will receive the files on the local machine you are on.
 
for your problem of transfering all your files..

ftp -i /directory/*

you can also add an alias for &quot;ftp&quot; in /etc/bashrc

alias ftp='ftp -i'

put the above line at the bottom of the /etc/bashrc file this will enable ftp to use interactive mode every time you use the command...meaning it will not prompt you to verify each file you wish to put or get.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top