Topic "Command Line not able to find files on remote server which include [ or ] in the filename"

Author Message
pault
[View user's profile]

Joined: 2017-02-09
Posts: 2
Location: Germany
I was testing some of the scripting features of WinSCP and I noticed I'm unable to download any files that include [ or ].

I'm running WinSCP version 5.9.3 (Build 7136) but previously was using 5.7 with the same issue. I'm on Windows 10 and using SFTP.

Below is the output of two tests - same file just renamed the second time manually. I tried this repeatedly, including double quotes, the full path, etc and it will always return a "No file matching XXX found" error. I should note, if you try and download using wildcards preceding the [ or ], it is able to successfully download it (i.e. "get TVShow.S02E02.720p.HDTV.x264-FLEET*" will work)

Code:
C:\Program Files (x86)\WinSCP>winscp.com
winscp> open sftp://username:password@host.com/path/to/files/
Searching for host...
Connecting to host...
Authenticating...
Using username "username".
Authenticating with pre-entered password.
Authenticated.
Starting the session...
Session started.
Active session: [1] username@host.com
winscp> dir
-rw-rw----   1 username    username    1111708992 Feb  6 21:15:41 2017 TVShow.S02E01.720p.HDTV.x264-SVA[eztv].mkv
-rw-rw----   1 username    username    1012275713 Feb  6 21:16:05 2017 TVShow.S02E02.720p.HDTV.x264-FLEET[eztv].mkv
winscp>
winscp> get TVShow.S02E02.720p.HDTV.x264-FLEET[eztv].mkv
No file matching 'TVShow.S02E02.720p.HDTV.x264-FLEET[eztv].mkv' found.
winscp> exit

C:\Program Files (x86)\WinSCP>



C:\Program Files (x86)\WinSCP>winscp.com
winscp> open sftp://username:password@host.com/path/to/files/
Searching for host...
Connecting to host...
Authenticating...
Using username "username".
Authenticating with pre-entered password.
Authenticated.
Starting the session...
Session started.
Active session: [1] username@host.com
winscp> dir
-rw-rw----   1 username    username    1111708992 Feb  6 21:15:41 2017 TVShow.S02E01.720p.HDTV.x264-SVA.eztv.mkv
-rw-rw----   1 username    username    1012275713 Feb  6 21:16:05 2017 TVShow.S02E02.720p.HDTV.x264-FLEET[eztv].mkv
winscp>
winscp> get TVShow.S02E01.720p.HDTV.x264-SVA.eztv.mkv C:\Incoming\
TVShow.S02E01.720p.HDTV.x |        7804 KB | 1348.1 KB/s | binary |   0%
Terminated by user.
winscp>
martin◆
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 27082
Location: Prague, Czechia
The [ and ] have a specific meaning in a file mask.
To use the [ literally (but not the ], contrary to your post), you have to escape it like [[].

See https://winscp.net/eng/docs/file_mask#basic
pault
[View user's profile]

Joined: 2017-02-09
Posts: 2
Location: Germany
OK I must have missed that... thanks for the explanation / workaround Smile
Advertisements

You can post new topics in this forum

Search

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