Ls incorrectly says file not found in sftp.

Hi all

When I sftp to an Oracle cloud server, to a folder where there are more than 10k files, and list a small subset of files, it works OK. When I try list more than 10k files, it says file not found. Example output below.

(FYI ls/mget with 6k files works OK on this server)

Has anyone else experienced this issue before? Same issue happens with mget command. I tried setting timeout to -1 before doing the sftp.

sftp> cd /Download/promotion/polling 
 sftp> ls -l *99999.mnt 
 -rw-------    0 1001     1002          721 Oct 16 13:26  XstorePromotionExportPromotionExport-Campaign12-promotion12.FRN.99999.mnt  
 -rw-------    0 1001     1002          831 Jan 16 13:46  XstorePromotionExportPromotionExport-Campaign26-promotion26.FRN.99999.mnt  
 -rw-------    0 1001     1002         2102 Dec 14 11:05  XstorePromotionExportPromotionExport-Campaign23-promotion23.FRN.99999.mnt  
 -rw-------    0 1001     1002          837 Nov 14 11:04  XstorePromotionExportPromotionExport-Campaign13-promotion13.FRN.99999.mnt  
 -rw-------    0 1001     1002          823 Dec 21 09:43  XstorePromotionExportPromotionExport-Campaign24-promotion24.FRN.99999.mnt  
 -rw-------    0 1001     1002          775 Oct 16 13:26  XstorePromotionExportPromotionExport-Campaign11-promotion11.FRN.99999.mnt  
 -rw-------    0 1001     1002          717 Dec 21 09:54  XstorePromotionExportPromotionExport-Campaign17-promotion17.FRN.99999.mnt  
 -rw-------    0 1001     1002          725 Jan 16 13:51  XstorePromotionExportPromotionExport-Campaign28-promotion28.FRN.99999.mnt  
 -rw-------    0 1001     1002          776 Jan 18 12:43  XstorePromotionExportPromotionExport-Campaign29-promotion29.FRN.99999.mnt  
 -rw-------    0 1001     1002          832 Nov 16 10:43  XstorePromotionExportPromotionExport-Campaign14-promotion14.FRN.99999.mnt  
 -rw-------    0 1001     1002          828 Nov 30 09:17  XstorePromotionExportPromotionExport-Campaign15-promotion15.FRN.99999.mnt  
 -rw-------    0 1001     1002          761 Jan 18 15:30  XstorePromotionExportPromotionExport-Campaign30-promotion30.FRN.99999.mnt  
 -rw-------    0 1001     1002          855 Oct 13 15:56  XstorePromotionExportPromotionExport-Campaign10-promotion10.FRN.99999.mnt  
 -rw-------    0 1001     1002          721 Jan 18 12:59  XstorePromotionExportPromotionExport-Campaign31-promotion31.FRN.99999.mnt  
 -rw-------    0 1001     1002          825 Jan 16 13:48  XstorePromotionExportPromotionExport-Campaign27-promotion27.FRN.99999.mnt  
 sftp> ls -l *.mnt 
 Can't ls: "/Download/promotion/polling/*.mnt" not found 
 sftp>

I can imagine there is internally an error "two many arguments", and the non-zero exit code is mis-interpreted then.

Thanks "MadeInGermany" for the reply, that makes sense. I will try some more and update the thread (unfortunately Oracle have purged some of the old files so now there are only 6k at the moment)

Just a quick reply to close out ticket. 10k file limit did appear to be too many files for mget * to process them all, so I changed it to a get -r on the folder (since the I want all the files in the folder, and there are no subfolders) Files came across with no issues.

2 Likes