scp specific files

anneranch

Active Member
Joined
Mar 16, 2019
Messages
155
Reaction score
39
Credits
1,318
I am trying to copy specific files from one OS to another.
I have two major issues using scp.

This syntax alone creates another folder - resulting in /usr/lib/arm-linux-gnueabihf/arm-linux-gnueabihf - on the destination and copies "stuff" to it until I stop it ( I think -r is part ot the issue )

sudo scp -r [email protected]:/usr/lib/arm-linux-gnueabihf/ /usr/lib/arm-linux-gnueabihf/

That is not of a majoir isse - I cam move the desired files around later.

What I really want is to scp specific files such as *bluetooth" .
I do not know how to option scp to do that .



[email protected]:/usr/lib/arm-linux-gnueabihf$ sudo scp [email protected]:/usr/lib/arm-linux-gnueabihf/libbluetooth* /usr/lib/arm-linux-gnueabihf/
[email protected]'s password:
scp: /usr/lib/arm-linux-gnueabihf: not a regular file
cp: cannot stat 'libbluetooth*': No such file or directory
[email protected]:/usr/lib/arm-linux-gnueabihf$ sudo scp [email protected]:/usr/lib/arm-linux-gnueabihf/ *libbluetooth* /usr/lib/arm-linux-gnueabihf/
[email protected]'s password:
scp: /usr/lib/arm-linux-gnueabihf: not a regular file
cp: cannot stat '*libbluetooth*': No such file or directory
[email protected]:/usr/lib/arm-linux-gnueabihf$
 


dos2unix

Well-Known Member
Joined
May 3, 2019
Messages
1,012
Reaction score
689
Credits
5,111
Can you send output of
ls -l /usr/lib/arm-linux-gnueab*

Also possibly the output of

file /usr/lib/arm-linux-gnueabihf

It appears you are trying to send a directory, not a file.
 

JasKinasis

Well-Known Member
Joined
Apr 25, 2017
Messages
1,318
Reaction score
1,870
Credits
8,314
I think you may either need to escape the asterisk using a backslash \* or use single, or double quotes around the path/filename.
e.g.
Escaping the asterisks with a backslash:
Bash:
sudo scp -r [email protected]:/usr/lib/arm-linux-gnueabihf/\*libbluetooth\* /usr/lib/arm-linux-gnueabihf/

Or using single quotes:
Bash:
sudo scp -r '[email protected]:/usr/lib/arm-linux-gnueabihf/*libbluetooth*' /usr/lib/arm-linux-gnueabihf/

Or double quotes:
Bash:
sudo scp -r "[email protected]:/usr/lib/arm-linux-gnueabihf/*libbluetooth*" /usr/lib/arm-linux-gnueabihf/

I'm not 100% certain, but I'd imagine that at least one, if not all of these will work for you!
 

Fanboi

Well-Known Member
Joined
Apr 16, 2021
Messages
358
Reaction score
270
Credits
4,288
Your remote host/server won't give you access to /usr/lib (it's root-owned) so it "doesn't exist" to the client coz it's invisible to the client.

Edit: I see you did authenticate yourself. My bad, didn't read the OP properly, just saw "No such file or directory"...
"Assumption is the mother of all fckups" lol.
 
Last edited:
OP
A

anneranch

Active Member
Joined
Mar 16, 2019
Messages
155
Reaction score
39
Credits
1,318
Can you send output of
ls -l /usr/lib/arm-linux-gnueab*

Also possibly the output of

file /usr/lib/arm-linux-gnueabihf

It appears you are trying to send a directory, not a file.

I actually wanted to scp the directory first
But
the command created another directory / folder and would not stop by itself.
I am go9ing to take a shortcut and link to /usr/lib/arm-linux-gnueabihf:
to see if it contains the file I need to link to.
ADDENDUM
I did this instead , it is pretty long but it does contain the fikle I need
Can somebody tell what "total" of ??
Please not the extra folder created on first line - do not need that

I WILL DELETE THE OUPUT IN A DAY OR SO !
sorry it WONT LE ME POST MESSAGE THIS long
[email protected]:~$ ls -l /usr/lib/arm-linux-gnueabihf/*
total 554888
drwxr-xr-x 74 root root 20480 Oct 18 20:00 arm-linux-gnueabihf
drwxr-xr-x 2 root root 4096 Oct 18 19:57 audit
drwxr-xr-x 2 root root 4096 Oct 18 19:57 avahi

drwxr-xr-x 4 root root 4096 Oct 18 20:01 vlc
[email protected]:~$





[email protected]:~$ ls -l /usr/lib/arm-linux-gnueab*
/usr/lib/arm-linux-gnueabi:
total 8
drwxr-xr-x 2 root root 4096 Sep 17 10:58 bfd-plugins
drwxr-xr-x 2 root root 4096 Sep 17 10:58 ldscripts

/usr/lib/arm-linux-gnueabihf:
total 36
drwxr-xr-x 34 root root 36864 Oct 18 20:01 arm-linux-gnueabihf
[email protected]:~$
 
Last edited:

KGIII

Super Moderator
Staff member
Gold Supporter
Joined
Jul 23, 2020
Messages
4,015
Reaction score
3,689
Credits
32,263

dos2unix

Well-Known Member
Joined
May 3, 2019
Messages
1,012
Reaction score
689
Credits
5,111
I actually wanted to scp the directory first

You can't scp a directory. (well, there are some tricks)
Usually if it's a lot of files (to me more than 3 is a lot)
I usually archive them up with tar or zip, and then transfer them all
at the same time (directory structure included).
 
$100 Digital Ocean Credit
Get a free VM to test out Linux!

Members online


Top