Shell script to batch download files using curl + cookie and merge those files -
i have list of urls files want download , join. can accessed when authenticated. first call:
curl -c cookie.txt http://url.to.authenticate then can download file file1 using cookie:
curl -b cookie.txt -o http://url.to.file1 at end use cat:
cat file1 file2 file3 ... > file_merged i have 320 of urls stored in text file , want create script these urls included in script, need copy script remote computer , execute it. not @ shell scripting , love if me out bit. maybe little more fail-proof than
#!/bin/sh curl -c cookie.txt http://url.to.authenticate curl -b cookie.txt -o http://url.to.file1 curl -b cookie.txt -o http://url.to.file2 curl -b cookie.txt -o http://url.to.file3 ... cat file1 file2 file3 ... file320 > file_merged
so, (if list of files stored in files.txt):
#!/bin/sh curl -c cookie.txt http://url.to.authenticate while read f; curl -b cookie.txt -o http://url.to."$f" cat "$f" >> file_merged rm -f "$f" done < files.txt
Comments
Post a Comment