4

I've seen this when using SFTP; for example when I try to remove a file that isn't on the remote server:

sftp> RM coa.dat.gz
Couldn't stat remote file: No such file or directory
Removing coa.dat.gz
Couldn't delete file: No such file or directory

Since "stat" isn't an English verb, this is a bit confusing.

It is clear that this has something to do with the UNIX/Linux command stat or the C function stat(), but I welcome a more complete description.

2 Answers 2

4

The sftp server is indeed trying to stat() the file before removing it. The file it tried to stat didn't exist therefore it couldn't stat the (remote) file and gave you the strerror_r() of the error number that stat received "No such file or directory"

$ man 2 stat ... it's in section 2 because it's a system call, not a section 3 standard library call.

0

As explained in this link, "Stat command displays file or filesystem status..." Note that the error may be generated because of lack of / improper permissions. Be sure to check that you have the appropriate permissions on the file/directory.

1
  • 1
    The directory/file is on a remote system running an sftp server, so he may be unable to check the permissions there; but if it were a problem with permissions the text following Couldn't stat remote file: would say something else, instead of "No such file or directory"
    – Stephen P
    Commented Jul 17, 2013 at 20:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .