Upload files using shell script

I want to upload several files that look like this:

http://example.com/directory/file1.txt
http://example.com/directory/file2.txt
http://example.com/directory/file3.txt
http://example.com/directory/file4.txt
.
.
http://example.com/directory/file199.txt
http://example.com/directory/file200.txt

Can someone help me with it using shell scripts? Here is what I use, but it only downloads the first file.

for i in {1..200}
do
exec wget http://example.com/directory/file$i.txt;
done
+4
source share
2 answers
wget http://example.com/directory/file{1..200}.txt

must do it. It expands to wget http://example.com/directory/file1.txt http://example.com/directory/file2.txt ....

Alternatively, your current code should work fine if you delete the call exec, which is not necessary and does not do what you seem to think it is doing.

+6
source

To load a list of files, you can use wget -i <file>where is the file name of the list of URLs to download.

: man wget

0

All Articles