Hi everyone,
I'm trying to list a specific file from a directory in a sftp server. I'm using Winscp 4.2.5 and the script command
ls
ls Nxxxxxxxxxxxxxxxxxxx-xxxxxxxxx.jpg
But the server always respond:
Error listing directory 'Nxxxxxxxxxxxxxxxxxxx-xxxxxxxxx.jpg'.
General failure (server should provide error description).
Error code: 4
Error message from server: "/Nxxxxxxxxxxxxxxxxxxx-xxxxxxxxx.jpg": directory not found.
Request code: 11
Rewriting the script in that way:
ls *Nxxxxxxxxxxxxxxxxxxx-xxxxxxxxx.jpg
It's working fine but it could have some problems if there more files with the same name and starting with other letters or characters.
I have the same problem with others commands to download (
get
), to upload (
put
) and to delete (
rm
). So that I can not, for example, delete a particular file without running the risk of deleting any more due to the use of the asterisk at the beginning of the filename.
At the beggining, I was thinking the problem could be on the server configuration. And I can't do anything about that because the server isn't mine. But installing a SFTP server in other computer to makes some test, I found the same problem. So now I'm thinking that the script language require this
*
to works fine.
I have to admit that this is the first time I'm programming with scripting languages to interact with an SFTP or an FTP server. I've always used graphical environments such as filezilla or winscp's own. And I've been looking at the page of winscp some information on the use of script commands in the forums, in the news ...... in other pages. Well I don't know where to look. Must be a stupid mistake on my part but I'm starting to get desperate
Someone could help me please.
Thanks a lot.