scp gives "not a regular file" scp gives "not a regular file" linux linux

scp gives "not a regular file"


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.


"/home/pictures/file.fits" must name an actual filesystem object on the remote server. If it didn't, scp would have given a different error message.

I see that FITS is an image format. I suppose "/home/pictures/file.fits" is the name of a directory on the remote server, containing FITS files or something like that.

To copy a directory with scp, you have to supply the "-r" flag:

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


One way this error can occur is if you have a space before the first path like below:

scp myUserName@HostName: /path/to/file  /path/to/new/file                            ^

To fix, just take the space out:

scp myUserName@HostName:/path/to/file  /path/to/new/file