Topic "TransferOptions FileMask"

Author Message
alfred101
[View user's profile]

Joined: 2012-07-18
Posts: 1
Location: US
Hi,
I was wondering on how to write a file mask to exclude a folder & and multiple file types
I am aware that we need to add a "|*.bak" to exclude bak, but if i have to exclude .bak & .svn then what do i do?
Also if i need to exclude an entire folder ...then how would the filter be?

"|*.bak |*.svn |/svn"

How do i do this?

Also, the file mask is a very powerful tool for selective FTPs, so more documentation and examples would help developers use this hidden gem fully.
Thanks

Very Happy
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
| *.bak; *.svn; svn/

I'll add some example once 5.x is stable. Now it would be confusing as the syntax between 4.x and 5.x is slightly idfferent.
_________________
Martin Prikryl
t0r3x
[View user's profile]

Joined: 2012-03-24
Posts: 12
Location: Netherlands
My question regards the same subject.

I am including a filemask in Session.GetFiles by setting the TransferOptions.FileMask as such: "/share/MD0_DATA/X250/Folder1/;/share/MD0_DATA/X250/Folder2/;", the remote path I set is "/share/MD0_DATA/X250/" but this does not seem to work, only when I use a mask for files.

What I want to do is only include those folders and/or files in the transfer. For files I leave out the last slash and for folders I make sure it ends with one.

I'm thinking the mask is somehow invalid for folders, although I followed the guidelines for creating a file mask. I have attached the session and debug log. Thanks.
debug_filemask.log (383.38 KB) [Download]

Description: debug log filemask

session_filemask.log (86.61 KB) [Download]

Description: session log filemask

martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
t0r3x wrote:
I am including a filemask in Session.GetFiles by setting the TransferOptions.FileMask as such: "/share/MD0_DATA/X250/Folder1/;/share/MD0_DATA/X250/Folder2/;", the remote path I set is "/share/MD0_DATA/X250/" but this does not seem to work, only when I use a mask for files.

It's difficult to help, when I know only that it "does not seem to work".

But anyway, if you download /share/MD0_DATA/X250/, it gets matches against mask and excluded, hence nothing downloads. Make sure you download /share/MD0_DATA/X250/* instead.

If that's not your case, make sure you provide more details.
_________________
Martin Prikryl
t0r3x
[View user's profile]

Joined: 2012-03-24
Posts: 12
Location: Netherlands
To clarify, I want to set a filemask that downloads /share/MD0_DATA/X250/Folder1/ and /share/MD0_DATA/X250/Folder2/ with ALL of it's subdirectories and files. The mask I used to use is just "/share/MD0_DATA/X250/Folder1/;/share/MD0_DATA/X250/Folder2". Now I am using "/share/MD0_DATA/X250/Folder1/*;/share/MD0_DATA/X250/Folder2/*", but this only downloads every file in Folder1/2 without including subdirectories and files, which I do want. I do not "know" any of the subdirectories, so I want to be able to do what I described with just 1 mask instead of one for every subdirectory/file. Thanks.
t0r3x
[View user's profile]

Joined: 2012-03-24
Posts: 12
Location: Netherlands
Anyone? Or still not clear what I mean Sad
t0r3x
[View user's profile]

Joined: 2012-03-24
Posts: 12
Location: Netherlands
Ok I tried to fix my problem (of wanting to download a selection with files, and in case it being a directory downloading all of its subdirectories and files) by now executing an "ls -RAp" command that tells me all of the underlying subdirectories. I now add all the files I do not want to download to an exclude mask. Problem is that this can be quite a few files (potentially hundreds).

New problem that has risen now is that the WinSCP get command only allows a certain number of characters. So when my exclude mask contains more than 10.175 characters the command breaks because it cuts off at the end:

Missing parameter for command 'get'.

> 2012-08-27 19:48:03.498 Script: get -nopermissions -preservetime -transfer="binary" -filemask="....;/share <== (misses quote at the end and cuts off)
. 2012-08-27 19:48:03.508 Script: Failed
> 2012-08-27 19:48:07.718 Script: exit
. 2012-08-27 19:48:07.718 Closing connection.
. 2012-08-27 19:48:07.718 Sending special code: 12
. 2012-08-27 19:48:07.718 Sent EOF message
t0r3x
[View user's profile]

Joined: 2012-03-24
Posts: 12
Location: Netherlands
Finally fixed my problem. In both my include and exclude masks I ended with a semi-colon (; ), which was the cause of all my problems.

Sidenote: using masks slows down the download progress incredibly! It doesn't seem to filter out the required files in smart way, that is too bad Sad. An other thing is that it locally creates every directory that is above your remote path you had set as your download location, even though these directories then will be empty when they were in the exclude mask.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
t0r3x wrote:
Sidenote: using masks slows down the download progress incredibly! It doesn't seem to filter out the required files in smart way, that is too bad Sad.

Can you please post a session log file both with and without the file mask?

Quote:
An other thing is that it locally creates every directory that is above your remote path you had set as your download location, even though these directories then will be empty when they were in the exclude mask.

Can you again post your complete script including the mask? And mention what local directories WinSCP has created that you believe it should had not.
_________________
Martin Prikryl
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