Put -delete -filemask... Failing (seemingly simple script)

Advertisement

todda.jones@kmbs
Guest

Put -delete -filemask... Failing (seemingly simple script)

Have a script that is failing.
Originally, the below statement worked:
put -delete *
This also worked:
put -delete *>=1N
Trying to split out the files as below is failing:
put -delete -filemask="*.tif>=1N"
put -delete -filemask="*.txt>=2N"
Any thoughts on what I'm doing wrong?

Reply with quote

Advertisement

todda.jones@kmbs
Guest

Re: Put -delete -filemask... Failing (seemingly simple script???)

< 2022-08-23 16:12:40.245 Script: sftpXXX:/Incoming/Sweeps
> 2022-08-23 16:12:40.245 Script: put -delete *.tif >1N
< 2022-08-23 16:12:40.245 Script: Are you sure you want to transfer multiple files to a single file '>1N' in a directory 'sftpXXX:/Incoming/Sweeps'?
< 2022-08-23 16:12:40.245 The files will overwrite one another.
< 2022-08-23 16:12:40.245 If you actually want to transfer all files to a directory 'sftpXXX:/Incoming/Sweeps/>1N/', keeping their name, make sure you terminate the path with a slash.
. 2022-08-23 16:12:40.245 Copying 3 files/directories to remote directory "sftpXXX:/Incoming/Sweeps" - total size: 802,120
 
< 2022-08-23 16:12:40.558 Status code: 20, Message: 1799, Server: The filename, directory name, or volume label syntax is incorrect. , Language: en 
* 2022-08-23 16:12:40.558 (ETerminal) The filename is not valid.
* 2022-08-23 16:12:40.558 Error code: 20
* 2022-08-23 16:12:40.558 Error message from server (en): The filename, directory name, or volume label syntax is incorrect. 
. 2022-08-23 16:12:40.558 Asking user:
. 2022-08-23 16:12:40.558 Cannot create remote file 'sftpXXX:/Incoming/Sweeps/sftpXXX:/Incoming/Sweeps/>1N.filepart'. ("The filename is not valid.
Trying to accomplish this:
put and delete tif files older than 1 minute
then
put and delete txt files older than 2 minutes

Attempting the following:
put -delete -filemask="*.tif<=1N" *

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
41,454
Location:
Prague, Czechia

Re: Put -delete -filemask... Failing (seemingly simple script)

The source parameter of the put command is mandatory.
https://winscp.net/eng/docs/scriptcommand_put
So this would work:
put -delete -filemask="*.tif>=1N" *
put -delete -filemask="*.txt>=2N" *
but this is more straightforward way to do the same (basically what you did originally)
put -delete *.tif>=1N
put -delete *.txt>=2N
Or oneliner:
put -delete *.tif>=1N *.txt>=2N

Reply with quote

Guest

Re: Put -delete -filemask... Failing (seemingly simple script)

NICE! Thanks Martin.
I think my original problem was the "direction" of the > or <
My brain said they should be opposite and I used the wrong one.

Working as expected. Any performance hits with the -filemask tag?

Reply with quote

martin
Site Admin
martin avatar

Re: Put -delete -filemask... Failing (seemingly simple script)

Not sure what performance hits you assume. Comparing to what?

Reply with quote

Advertisement

You can post new topics in this forum