"wput" multiple files from command line?

6

You can upload a single file with wput:

wput file ftp://username:passwd@ipaddress/file

is there a way to upload multiple? Maybe something like:

wput {file1,file2} ftp://username:passwd@ipaddress/{file1,file2}

Note: I know there are solutions using ftp, curl, and others. I was wondering if there is one for wput.

dinkelk

Posted 2013-05-02T02:12:24.420

Reputation: 203

Answers

3

From the manual:

So you can specify e.g. one URL and read all filenames from a file. 
Or use wput *.txt ftp://host, to transfer all *.txt-files. 
See EXAMPLES for further examples.

−i file

−−input−file=file

Reads URLs and filenames from file. If there are URLs on the command-line too, these will be retrieved first, unless sorting is enabled. See also the URL-Input-Handling section. If file is −, the URLs will be read from stdin. If you want to pipe the contents of the file that shall be uploaded to stdin, this cannot be done (yet). But you can use the --input-pipe flag and read the contents a) from a named pipe -I "cat named.pipe; echo > /dev/null" or b) directly from the command, that outputs the data. (See --input-pipe) Do not do things like find | wput ftp://host/ −i −! Wput would upload all files from the current directory (since the first output of find will be ’.’) and afterwards each file again (since find postes its name to Wput. And further problematic is that Wput will upload each directory that is given by find and since find itself recurses all directories, the files would be uploaded three times (or even more often for further subdirectories). Use wput ftp://host/ to upload everything from the local directory. Or use find ! −type d | wput ftp://host/ −i − to tell find, not to output directories.

Endoro

Posted 2013-05-02T02:12:24.420

Reputation: 2 036