Correct Syntax to get file with [ in filename, filemask syntax

Advertisement

pryder
Joined:
Posts:
1
Location:
Midwest

Correct Syntax to get file with [ in filename, filemask syntax

Hello,
I am trying to get files from an external host with SFTP using WINSCP and a batch file, ultimately will use as part of scheduled task with many processes running batch file from homegrown console app. I am not able to get files with square brackets in filename and have not figured out the correct syntax to get it to work. I have seen some post about this in the forum but am obviously to ignorant to get it to work. Here is a log from my latest attempt, the file is 129[12].txt so I thought the filemask should be
-filemask=*[[*].txt to allow for characters before the [ and characters inside but this is not correct since it does not work. Here is the log file I generated...

2017-03-09 11:14:39.324 Using SFTP protocol.
. 2017-03-09 11:14:39.324 Doing startup conversation with host.
> 2017-03-09 11:14:39.324 Type: SSH_FXP_INIT, Size: 5, Number: -1
< 2017-03-09 11:14:39.386 Type: SSH_FXP_VERSION, Size: 5, Number: -1
. 2017-03-09 11:14:39.386 SFTP version 4 negotiated.
. 2017-03-09 11:14:39.386 We will use UTF-8 strings as it is mandatory with SFTP version 4 and newer
. 2017-03-09 11:14:39.386 Getting current directory name.
. 2017-03-09 11:14:39.386 Getting real path for '.'
> 2017-03-09 11:14:39.386 Type: SSH_FXP_REALPATH, Size: 10, Number: 16
< 2017-03-09 11:14:39.480 Type: SSH_FXP_NAME, Size: 23, Number: 16
. 2017-03-09 11:14:39.480 Real path is '/'
. 2017-03-09 11:14:39.480 Startup conversation with host finished.
< 2017-03-09 11:14:39.480 Script: Active session: [1] test@sftp.test.org
> 2017-03-09 11:14:39.480 Script: option transfer binary
< 2017-03-09 11:14:39.480 Script: transfer binary
> 2017-03-09 11:14:39.480 Script: cd \Outbox_Katy\
. 2017-03-09 11:14:39.480 Cached directory change via "\Outbox_Katy\" to "/Outbox_Katy".
. 2017-03-09 11:14:39.480 Getting current directory name.
< 2017-03-09 11:14:39.480 Script: /Outbox_Katy
> 2017-03-09 11:14:39.480 Script: get -filemask=*[[*].txt| "129[12].txt" \\testserver\FTP\OC_Statements\OC_Production\OC_Production_714\Import\KatyFiles\
. 2017-03-09 11:14:39.480 Listing directory "/Outbox_Katy".
> 2017-03-09 11:14:39.480 Type: SSH_FXP_OPENDIR, Size: 21, Number: 267
< 2017-03-09 11:14:39.574 Type: SSH_FXP_HANDLE, Size: 11, Number: 267
> 2017-03-09 11:14:39.574 Type: SSH_FXP_READDIR, Size: 11, Number: 524
< 2017-03-09 11:14:39.652 Type: SSH_FXP_NAME, Size: 313, Number: 524
> 2017-03-09 11:14:39.652 Type: SSH_FXP_READDIR, Size: 11, Number: 780
< 2017-03-09 11:14:39.714 Type: SSH_FXP_STATUS, Size: 28, Number: 780
< 2017-03-09 11:14:39.714 Status code: 1
> 2017-03-09 11:14:39.714 Type: SSH_FXP_CLOSE, Size: 11, Number: 1028
. 2017-03-09 11:14:39.714 .;D;0;2017-03-08T19:19:46.000Z;"" [0];"" [0];rwxr-x---;2
. 2017-03-09 11:14:39.714 ..;D;0;2017-01-31T16:12:28.000Z;"" [0];"" [0];rwxr-x---;0
. 2017-03-09 11:14:39.714 129[12].txt;-;1246;2017-03-07T22:38:08.000Z;"" [0];"" [0];rwxr-x---;0
. 2017-03-09 11:14:39.714 20170209.16_1500.20170201.09_1502.ML[WPSGHA-MAC]105170202P00760CAR0000.835_PLB.835;-;833;2017-03-07T16:18:14.000Z;"" [0];"" [0];rwxr-x---;0
. 2017-03-09 11:14:39.714 Archive;D;0;2017-03-07T18:00:30.000Z;"" [0];"" [0];rwxr-x---;0
< 2017-03-09 11:14:39.714 Script: No file matching '129[12].txt' found.
< 2017-03-09 11:14:39.714 Script: Using configured transfer settings different from factory defaults.
. 2017-03-09 11:14:39.714 Copying 0 files/directories to local directory "\\testserver\FTP\OC_Statements\OC_Production\OC_Production_714\Import\KatyFiles\"
. 2017-03-09 11:14:39.714 PrTime: No; PrRO: No; Rght: rw-r--r--; PrR: No (Yes); FnCs: N; RIC: 0100; Resume: N (102400); CalcS: No; Mask:
. 2017-03-09 11:14:39.714 TM: B; ClAr: No; RemEOF: No; RemBOM: No; CPS: 0; NewerOnly: No; InclM: *[[*].txt|; ResumeL: 0
. 2017-03-09 11:14:39.714 AscM: *.*html; *.htm; *.txt; *.php; *.php3; *.cgi; *.c; *.cpp; *.h; *.pas; *.bas; *.tex; *.pl; .htaccess; *.xtml; *.css; *.cfg; *.ini; *.sh; *.xml
> 2017-03-09 11:14:39.714 Script: Exit
. 2017-03-09 11:14:39.714 Script: Exit code: 0
. 2017-03-09 11:14:39.714 Closing connection.
. 2017-03-09 11:14:39.714 Sending special code: 12
. 2017-03-09 11:14:39.714 Sent EOF message

Any suggestions would be greatly appreciated.
Thank you

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
40,476
Location:
Prague, Czechia

Re: Correct Syntax to get file with [ in filename, filemask syntax

It's

get "129[[]12].txt" \\testserver\FTP\OC_Statements\OC_Production

No -filemask.

Reply with quote

Advertisement

You can post new topics in this forum