Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

scp gives "not a regular file"

Tags:

linux

scp

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?

like image 521
Fourmicroonde Avatar asked Apr 09 '15 19:04

Fourmicroonde


People also ask

What is not a regular file in Linux?

A regular file is a file that isn't a directory or more exotic kinds of “special” files such as named pipes, devices, sockets, doors, etc. Symbolic links are not regular files either, but they behave like their target when it an application is accessing the content of the file.

Is not a regular file SFTP?

In short, SFTP get not a regular file is an error message which indicates an incomplete command usage. So, either transfer the file recursively or use alternatives like SCP or rsync. Today, we saw how our Support Engineers help customer transfer files remotely.

How do I SCP an entire file?

To copy a directory (and all the files it contains), use scp with the -r option. This tells scp to recursively copy the source directory and its contents. You'll be prompted for your password on the source system ( deathstar.com ). The command won't work unless you enter the correct password.

What is SCP format file?

scp (secure copy) command in Linux system is used to copy file(s) between servers in a secure way. The SCP command or secure copy allows secure transferring of files in between the local host and the remote host or between two remote hosts.


4 Answers

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.

like image 136
Multimedia Mike Avatar answered Nov 09 '22 10:11

Multimedia Mike


"/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 . 
like image 22
Kenster Avatar answered Nov 09 '22 10:11

Kenster


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
like image 41
wizurd Avatar answered Nov 09 '22 08:11

wizurd


simple steps you need to follow

1)scp -r user@host:/var/www/html/projectFolder /var/www/html/localsystem-project-folder

2)scp -r user@host:/var/www/html/projectFolder/filename.php /var/www/html/localsystem-project-folder/

here -r is for recursive traverse the director will help you without any error.

like image 30
niraj rahi Avatar answered Nov 09 '22 08:11

niraj rahi