CodeGirl
CodeGirl

Reputation: 101

Downloading Specific Filenames with FTP

I have about 1,000,000 files and I should do FTP to get some specific files. in 1,000,000 files with the name of ML0000000-ML1000000 i want specific file starts ML00002222 till ML00899999. can anyone help me how to edir mget for ftp ?

######login to FTP server:@@@@@
ftp -inv 172.0.0.1
user Codegirl $$$$
#######cd to ftp server#########
cd /root/desktop
######cd to local PC#############
lcd /root/myfile
*mget ML*   ??? (how can i change it to specific file name?)*

Upvotes: 0

Views: 139

Answers (1)

nelgin
nelgin

Reputation: 36

If it was me I'd use a loop and wget.

cd /root/myfile

for i in $(seq -f "%08g" 2222 899999)

do
  wget --username=un --password=pw ftp://172.0.0.1/root/desktop/ML${i}
done

This does require wget to reconnect each time, it's going to take time anyway so go and run the script and grab a cup of tea. I use loops like this all the time and it works well.

Upvotes: 1

Related Questions