Bach script download from txt file and upload ftp

Status
Not open for further replies.

nelo1

Active Member
140
2009
5
0
Bash script download from txt file and upload ftp

script in bash download from txt file and upload ftp

imagine have txt have many links rapidshare and bash script download for computer and upload for ftp

like remote upload
 
Last edited:
17 comments
Since I don't have rapidshare I can't say they have ftp access anymore.

Check your premium account and see if they still have ftp access. If yes then try to connect using ftp command from a ssh console.

This is presuming you have your own vps or dedi. Then if it works a bash can be made.
 
but i need upload for ftp
and need he download one file and make upload and remove this file and download next line "url" and upload
make loop
if have something run and make all will be great
 
Last edited:
Explain it better.

You are downloading the list?

Then you want to send the files from the url on the list to a ftp site? Not the current server you want to run the bash from?

Is this absolutely correct now?
 
Last edited:
if yes sendiing only file at a time
Code:
#!/bin/bash

#Variables
 FTPHOSTNAME="your ftp host url"
 FTPUSERNAME="your_ftp_user"
 FTPPASSWORD="your_ftp_password"

# get list
rm -f files.txt
wget -c files.txt

variable=$(cat files.txt)

#create a files folder and change to it
if [ ! -d "files" ]; then
  mkdir -p files
fi
cd files

#Loop and ftp each file single
for line in $variable
do
echo $line

# get file
 rm -f *.*
 wget -c $line

#ftp file
ftp -inv $FTPHOSTNAME << EOF
  user $FTPUSERNAME $FTPPASSWORD
  mput *
 ls
bye
EOF

rm -f *.*
done
exit
 
Last edited:
I checked and tried to get it directly from the site with http and it also said file not found. Has nothing to do with the %0D ..

Did you create a file on that server called files.txt with the links in it?
 
It worked fine for me . It got the files with a real url.

You are putting blank lines between fields or hitting the cr(enter key/%0D) twice.

That is why it shows not founds.
 
Status
Not open for further replies.
Back
Top