Scp Upload/Download

Download/Upload from a remote server.

scp -r <source> <destination>
1

Upload

scp -r folder username@exemple.com:/path/to/foo
1

Download

scp -r username@exemple.com:/path/to/foo folder
1

Exemple

File/folder with espace

scp -r username@exemple.com:"'/path/to/folder with espace'" folder
1

Use fd & fzf for upload file

scp "$(fd | fzf)" username@exemple.com:/path/to/folder
1

Select download

#!/bin/sh
select brand in "Kaamelott Livre I" "Kaamelott Livre II" "Kaamelott Livre III" "Kaamelott Livre IV" "Kaamelott Livre V" "Kaamelott Livre VI"
do
echo "You have chosen $brand download"
	case $brand in
		"Kaamelott Livre I")
			scp -r pi@raspberrypi:"'/mnt/disk1/Movies/[ OxTorrent.com ] Kaamelott/Livre I'" /Users/slote/Desktop/Kaamelott
		;;
		"Kaamelott Livre II")
			scp -r pi@raspberrypi:"'/mnt/disk1/Movies/[ OxTorrent.com ] Kaamelott/Livre II'" /Users/slote/Desktop/Kaamelott
		;;
		"Kaamelott Livre III")
			scp -r pi@raspberrypi:"'/mnt/disk1/Movies/[ OxTorrent.com ] Kaamelott/Livre III'" /Users/slote/Desktop/Kaamelott
		;;
		"Kaamelott Livre IV")
			scp -r pi@raspberrypi:"'/mnt/disk1/Movies/[ OxTorrent.com ] Kaamelott/Livre IV'" /Users/slote/Desktop/Kaamelott
		;;
		"Kaamelott Livre V")
			scp -r pi@raspberrypi:"'/mnt/disk1/Movies/[ OxTorrent.com ] Kaamelott/Livre V'" /Users/slote/Desktop/Kaamelott
		;;
		"Kaamelott Livre VI")
			scp -r pi@raspberrypi:"'/mnt/disk1/Movies/[ OxTorrent.com ] Kaamelott/Livre VI'" /Users/slote/Desktop/Kaamelott
		;;
		*)
			echo "Invalid entry."
		break
		;;
	esac
done
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29

Use fzf & xargs for download folder

#!/bin/sh
echo " Livre I\n" "Livre II\n" "Livre III\n" "Livre IV\n" "Livre V\n" "Livre VI" | \
 fzf | \
 xargs -I {} \
 scp -r pi@raspberrypi:"'/mnt/disk1/Movies/[ OxTorrent.com ] Kaamelott/{}'" .
1
2
3
4
5
Last Updated: 1/15/2020, 3:22:40 AM