Skip to main content

How to ‘Grab’ the Files That You Need from FTP Site?

How To 'grab' The Files That You Need From FTP Site?

How to 'grab' the files that you need from FTP site?

Introduction

If you need some packages, but you are in offline situations. That means you cannot connect to the internet. You can prepare to download that you need packages in free time. To do this, you can cost down a lot of time to search packages.
By the way, if you don't want to connect to the internet when you install Operation System. This is an easy way. It's benefits that you can avoid hacker or cracker into your system when you install the OS by internet.
However, this essay only talks about how to download you want packages from the FTP site. Because almost FTP site has numerous files, we don't need whole one.
There are two methods of grabbing it and you are able to filter files.

Equipment

Operation System: Ubuntu 14.04 LTS

Usage

1.. The 'wget' is a useful tool and you can manipulate it.

$ sudo apt-get install wget

2.. If you want to crab whole files from an FTP site, you can use this instruction. For example, the FTP site's hyperlink is 'ftp://ftp.ca.debian.org/debian/' and it accepts the anonymous to access. The FTP hyperlink format is 'ftp://anonymous(your login account name):password(your password)@ftp.cadebian.org(a FTP hyperlink).

$ wget --recursive ftp://anonymous:@ftp.ca.debian.org/debian

3.. If you just want to download that you need files, you should use the filter mechanism by 'wget'. In this case, you just want to download that file name suffix are such as 'armhf.deb', 'all.deb', 'tar.gz', '.dsc' and 'tar.xz' from FTP site. You can use the instruction called '--accept' to the download you want.

$ wget --recursive --accept="*armhf.deb","*all.deb","*tar.gz","*.dsc","*tar.xz" ftp://anonymous:@ftp.ca.debian.org/debian/

--2014-11-30 11:44:16-- ftp://anonymous:password@ftp.ca.debian.org/debian/pool/main/j/jzip/j
=> ‘ftp.ca.debian.org/debian/pool/main/j/jzip/.listing’
==> CWD (1) /debian/pool/main/j/jzip ... done.
==> PASV ... done. ==> LIST ... done.
[ <=> ] 4,130 --.-K/s in 0.006s
2014-11-30 11:44:18 (688 KB/s) - ‘ftp.ca.debian.org/debian/pool/main/j/jzip/.listing’ saved [4130]

Removed ‘ftp.ca.debian.org/debian/pool/main/j/jzip/.listing’.
Rejecting ‘jzip_210r20001005d-1_amd64.deb’.
Rejecting ‘jzip_210r20001005d-1_armel.deb’.
Rejecting ‘jzip_210r20001005d-1_i386.deb’.
Rejecting ‘jzip_210r20001005d-1_ia64.deb’.
Rejecting ‘jzip_210r20001005d-1_kfreebsd-amd64.deb’.
Rejecting ‘jzip_210r20001005d-1_kfreebsd-i386.deb’.
Rejecting ‘jzip_210r20001005d-1_mips.deb’.
Rejecting ‘jzip_210r20001005d-1_mipsel.deb’.
Rejecting ‘jzip_210r20001005d-1_powerpc.deb’.
Rejecting ‘jzip_210r20001005d-1_s390.deb’.
Rejecting ‘jzip_210r20001005d-1_sparc.deb’.
Rejecting ‘jzip_210r20001005d-2_amd64.deb’.
Rejecting ‘jzip_210r20001005d-2_armel.deb’.
Rejecting ‘jzip_210r20001005d-2_i386.deb’.
Rejecting ‘jzip_210r20001005d-2_ia64.deb’.
Rejecting ‘jzip_210r20001005d-2_kfreebsd-amd64.deb’.
Rejecting ‘jzip_210r20001005d-2_kfreebsd-i386.deb’.
Rejecting ‘jzip_210r20001005d-2_mips.deb’.
Rejecting ‘jzip_210r20001005d-2_mipsel.deb’.
Rejecting ‘jzip_210r20001005d-2_powerpc.deb’.
Rejecting ‘jzip_210r20001005d-2_s390.deb’.
Rejecting ‘jzip_210r20001005d-2_s390x.deb’.
Rejecting ‘jzip_210r20001005d-2_sparc.deb’.
Rejecting ‘jzip_210r20001005d-3_amd64.deb’.
Rejecting ‘jzip_210r20001005d-3_arm64.deb’.
Rejecting ‘jzip_210r20001005d-3_armel.deb’.
Rejecting ‘jzip_210r20001005d-3_hurd-i386.deb’.
Rejecting ‘jzip_210r20001005d-3_i386.deb’.
Rejecting ‘jzip_210r20001005d-3_kfreebsd-amd64.deb’.
Rejecting ‘jzip_210r20001005d-3_kfreebsd-i386.deb’.
Rejecting ‘jzip_210r20001005d-3_mips.deb’.
Rejecting ‘jzip_210r20001005d-3_mipsel.deb’.
Rejecting ‘jzip_210r20001005d-3_powerpc.deb’.
Rejecting ‘jzip_210r20001005d-3_ppc64el.deb’.
Rejecting ‘jzip_210r20001005d-3_s390x.deb’.
Rejecting ‘jzip_210r20001005d-3_sparc.deb’.
Rejecting ‘jzip_210r20001005d.orig.tar.bz2’.

--2014-11-30 11:44:18-- ftp://anonymous:password@ftp.ca.debian.org/debian/pool/main/j/jzip/jzip_210r20001005d-1.debian.tar.gz
=> ‘ftp.ca.debian.org/debian/pool/main/j/jzip/jzip_210r20001005d-1.debian.tar.gz’
==> CWD not required.
==> PASV ... done. ==> RETR jzip_210r20001005d-1.debian.tar.gz ... done.
Length: 9822 (9.6K)
100%[======================================>] 9,822 32.7KB/s in 0.3s
… (More and ignore)
--2014-11-30 11:44:45-- ftp://anonymous:password@ftp.ca.debian.org/debian/pool/main/j/jzlib/libjzlib-java_1.1.3-1_all.deb
=> ‘ftp.ca.debian.org/debian/pool/main/j/jzlib/libjzlib-java_1.1.3-1_all.deb’
==> CWD not required.
==> PASV ... done. ==> RETR libjzlib-java_1.1.3-1_all.deb ... done.
Length: 69926 (68K)
100%[======================================>] 69,926 67.1KB/s in 1.0s
2014-11-30 11:44:47 (67.1 KB/s) - ‘ftp.ca.debian.org/debian/pool/main/j/jzlib/libjzlib-java_1.1.3-1_all.deb’ saved [69926]

FINISHED --2014-11-30 11:44:47--
Total wall clock time: 2h 5m 5s
Downloaded: 3044 files, 1.1G in 1h 4m 34s (311 KB/s)

4.. There are many FTP site [3] of the Debian for you.

North America

ftp.us.debian.org/debian
http.us.debian.org/debian
ftp.debian.org/debian
ftp.ca.debian.org/debian
ftp.mx.debian.org/debian

South America

ftp.br.debian.org/debian
ftp.cl.debian.org/debian
download.unesp.br/linux/debian
sft.if.usp.br/debian
debian.torredehanoi.org/debian

Asia

ftp.cn.debian.org/debian
ftp.jp.debian.org/debian
ftp.kr.debian.org/debian
ftp.hk.debian.org/debian
ftp.tw.debian.org/debian

Africa

debian.mirror.ac.za/debian

Europe

ftp.de.debian.org/debian
ftp.at.debian.org/debian
ftp.bg.debian.org/debian
ftp.ch.debian.org/debian
ftp.cz.debian.org/debian
ftp.dk.debian.org/debian
ftp.ee.debian.org/debian
ftp.es.debian.org/debian
ftp.fi.debian.org/debian
ftp.fr.debian.org/debian
ftp.hr.debian.org/debian
ftp.hu.debian.org/debian
ftp.ie.debian.org/debian
ftp.is.debian.org/debian
ftp.it.debian.org/debian
ftp.lt.debian.org/debian
ftp.nl.debian.org/debian
ftp.no.debian.org/debian
ftp.pl.debian.org/debian
ftp.ro.debian.org/debian
ftp.ru.debian.org/debian
ftp.se.debian.org/debian
ftp.si.debian.org/debian
ftp.tr.debian.org/debian
ftp.uk.debian.org/debian

Oceania

ftp.au.debian.org/debian
ftp.wa.au.debian.org/debian
ftp.nz.debian.org/debian

Exception

1.. If you are feeling too much files and that you mess up. You want to delete some files, but you are still to keep other files. You should use this command called 'find'. It is a very useful tool that helping filter files and deleting files as you don't need.
In this case, you don't need suffix of file name, such as 'i386.deb', 'ia64.deb', 'mips.deb', mipsel.deb', 'powerpc.deb', 'sparc.deb', 'armel.deb', 'ppc64el.deb' and 'arm64.deb'. You could be doing those instructions as below. The 'find' will be to do recursive whole sub-directories and executing your command-line as 'rm -rf'.

$ find . -name "*i386.deb" -exec rm -rf {} \;
$ find . -name "*ia64.deb" -exec rm -rf {} \;
$ find . -name "*mips.deb" -exec rm -rf {} \;
$ find . -name "*mipsel.deb" -exec rm -rf {} \;
$ find . -name "*powerpc.deb" -exec rm -rf {} \;
$ find . -name "*sparc.deb" -exec rm -rf {} \;
$ find . -name "*armel.deb" -exec rm -rf {} \;
$ find . -name "*ppc64el.deb" -exec rm -rf {} \;
$ find . -name "*arm64.deb" -exec rm -rf {} \;

Acknowledge

Thank you (Google, Debian, GNU, Computer Hope) very much for this great methods.

Popular posts from this blog

Python 日期與時間的處理

Visual Basic 6.0 (VB6) 程式語言案例學習 (10. 條碼列印程式)

寫作:波蘭文學習之旅:1-1. 波蘭文字母與發音(注音版)

Python 日期與時間的處理

Image

Visual Basic 6.0 (VB6) 程式語言案例學習 (10. 條碼列印程式)

Image

寫作:波蘭文學習之旅:1-1. 波蘭文字母與發音(注音版)

Image

數位影像處理:最佳化處理策略之快速消除扭曲演算法

Image

用10種程式語言做影像二值化(Image binarization)

Visual Basic 6.0 (VB6) 程式語言案例學習 (04. 人事考勤管理系統)

Image

Visual Basic 6.0 (VB6) 程式語言案例學習 (07. 收據列印程式)

Image

Visual Basic .Net (VB.Net) 程式語言案例學習 (06. 題庫測驗系統)

Image

Visual Basic .Net (VB.Net) 程式語言案例學習 (03. 場地預約系統)

Image

Visual Basic 6.0 (VB6) 程式語言案例學習 (11. 生產線拍照程式)

Image