I have a csv file with 3 columns as follow, I need to create a batch file to download the images in the URLs from a FTP server to a folder and rename them to a new name from column A.
New_Name,URL,Status
MyName1.jpg,ftp://images:Img12345@FTP-Location.com/images/image01.jpg,File Downloaded
MyName2.jpg,ftp://images:Img12345@FTP-Location.com/images/image02.jpg,File Downloaded
MyName3.jpg,ftp://images:Img12345@FTP-Location.com/images/image03.jpg,File Not Found
It would really be fantastic, if it could write the status of the download back to the csv file! If the file was downloaded successfully it would write "File Downloaded" it in column C (Status), otherwise it would write "File Not Found".
Is this possible?
For starter, I utilized the following script, called test.sh
, issued the command sh test.sh
at the command prompt, just to download the URLs, without any luck!
#!/bin/sh
for link in `cat test.csv | cut -d, -f2`
do
wget $link -O /mnt/nas_1tb/a-test/
done
I found the above code from here.