Topic "Script with ls followed by an individual file name gives an error"

Author Message
PaulDD
[View user's profile]
Donor
Joined: 2016-07-02
Posts: 1
Location: North Carolina
Using 5.7.7 on Windows 7 in a script. I put a file to the site and have an ls command, followed by the file name, which gives this error from the log:

> 2016-07-02 10:28:31.673 Script: ls uszc-basic-full.csv
. 2016-07-02 10:28:31.674 Retrieving directory listing...
> 2016-07-02 10:28:31.674 CWD /site/data/uszc-basic-full.csv/
< 2016-07-02 10:28:31.769 550 The system cannot find the path specified.
. 2016-07-02 10:28:31.779 Could not retrieve directory listing
. 2016-07-02 10:28:31.779 Asking user:
. 2016-07-02 10:28:31.779 Error listing directory 'uszc-basic-full.csv'. ("Could not retrieve directory listing","The system cannot find the path specified. ")
< 2016-07-02 10:28:31.779 Script: Error listing directory 'uszc-basic-full.csv'.
< 2016-07-02 10:28:31.780 Script: Could not retrieve directory listing

< 2016-07-02 10:28:31.780 The system cannot find the path specified.
. 2016-07-02 10:28:31.783 Script: Failed
. 2016-07-02 10:28:31.783 Script: Exit code: 1
. 2016-07-02 10:28:31.788 Disconnected from server

It seems to think that the file name is part of the path. If I put an asterisk after the file name, it works fine, so that will be my workaround for now.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25015
Location: Prague, Czechia
Because "listing a file" is not supported.

The argument of the ls command has to be a path to a directory, optionally followed by a wildcard:
https://winscp.net/eng/docs/scriptcommand_ls

If you want to retrieve properties of a single file, use the stat command:
https://winscp.net/eng/docs/scriptcommand_stat
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License