I need help regarding downloading the files from FTP Server to the Local Server.
for downloading i need to use the FTP In batch Mode capability and I have a txt file with with all the files which needs to be downloaded.
file.txt
cap/media/101/101.mp4
cap/media/102/102.mp4
cap/media/103/103.mp4
cap/media/104/104.mp4
cap/media/105/105.mp4
cap/media/106/106.mp4
cap/media/101
is the folder structure inside the FTP user root and 101.mp4 is the file.
so the folder structure for 1000 of file is same and the mp4 is located as listed.
so i need a bash script which can run in Batch mode capability and download all the files automatically to the local Storage.
I have created that script but it is not working, hopefully someone can give me some hints,
###########################
HOST="ftp.remote.com"
USER="media"
PASSWORD="test"
FILE="/tmp/list.txt"
###########################
cd /tmp/
while read p; do
pt=$(dirname $p);
h="/"
pth=$pt$h
mxf=$(basename $p);
#echo $pth;
#echo $mxf;
ftp -n -v >> /tmp/filetransfer.log 2>&1 $HOST <<EOF
binary
user $USER $PASSWORD
prompt
lcd /tmp/media
cd $pth
mget $mxf
quit
EOF
done < /tmp/list.txt
and that is the output of the FTP Can you please help me here , I am not understanding what excatly i am doing wrong.
Connected to ftp.remote.com
220-FTPD
220 This is a private system - No anonymous login
200 TYPE is now 8-bit binary
331 User media OK. Password required
230 OK. Current restricted directory is /
Remote system type is UNIX.
Using binary mode to transfer files.
Interactive mode off.
Local directory now /tmp/media
250 OK. Current directory is cap/media
221-Goodbye. You uploaded 0 and downloaded 0 kbytes.
221 Logout.
I am having this error: 221-Goodbye. You uploaded 0 and downloaded 0 kbytes.
thank you for any comment and advice in Advance.
Connected to ftp.remote.com. 220-FTPD 220 This is a private system - No anonymous login 200 TYPE is now ASCII 331 User media OK. Password required 230 OK. Current restricted directory is / Remote system type is UNIX. Using binary mode to transfer files. Interactive mode off. 221-Goodbye. You uploaded 0 and downloaded 0 kbytes. 221 Logout
this is the Output, so now files are being downloading.mget *
work?