scp gives "not a regular file"

Fourmicroonde picture Fourmicroonde · Apr 9, 2015 · Viewed 97.4k times · Source

I have a problem when using scp on Linux, it says "not a regular file". I looked at other questions/answers about that, but I can't find out what's wrong... I wrote:

scp aa@aa:/home/pictures/file.fits .

to copy file.fits from aa@aa, /home/pictures to the current directory. I also tried without using /home/, but it didn't work neither...

Do you understand what's wrong?

Answer

Multimedia Mike picture Multimedia Mike · Apr 9, 2015

I just tested this and found at least 3 situations in which scp will return not a regular file:

  1. File is actually a directory
  2. File is a named pipe (a.k.a. FIFO)
  3. File is a device file

Case #1 seems most likely. If you meant to transfer an entire directory structure with scp use the -r option to indicate recursive copy.