Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

pault

OK I must have missed that... thanks for the explanation / workaround :)
martin

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

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

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

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)

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>