Filemask - Excluding File Size That Aren't Just Zero In Bytes

Advertisement

MoogleUK
Joined:
Posts:
2
Location:
UK

Filemask - Excluding File Size That Aren't Just Zero In Bytes

Hi, I'm using WinSCP to access several FTP's to download multiple files. This is working like a charm for me. The issue I am facing is that I'm trying to exclude some files from being downloaded. As an example of the code I am using;

open ftpes://********:********@ftps.engage.********.com/ -rawsettings ProxyPort=0
cd /****
synchronize local "N:\Raw ****\RK Test\**** ****\" -filemask="*.cd*; >35D; >40"

So on the above the synchronize should ignore any files older than 35 days (this is working) and then any file that is below 40 bytes in size. Currently there are to sizes of files that contain no data but get created due to timestamp checks. These can either be 0 bytes or 39 bytes in size. Using the above as it is, the files that are 0 bytes are check and then ignored however the files that are still 39 bytes are being downloaded. Is there something I am doing wrong here or is this not possible and if the latter why it it then working on the 0 byte filesize?

My work around right now is to do the following after the FTP synchronize has completed;

PUSHD "N:\Raw ****\RK Test\**** ****"
FOR %%J IN (*) DO IF %%~ZJ LEQ 39 DEL "%%~J"
POPD

This removes anything below 39 bytes but due to the number of files this takes, using the %TIME% in my BAT file it shows it took 2 hrs 10 mins to synchronize the FTPs and then another 2 hours to do the removal script.

Thanks if any help can be given.

Reply with quote

Advertisement

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

Re: Filemask - Excluding File Size That Aren't Just Zero In Bytes

synchronize local "N:\Raw ****\RK Test\**** ****\" -filemask="*.cd*; >35D; >40"
Your include file mask says, download all files that either has .cd* extension OR is newer than 35 days OR is larger than 40 bytes.

You probably want an exclude mask instead:
-filemask="*.cd* | <=35D; <=40"

https://winscp.net/eng/docs/file_mask#include_exclude

Reply with quote

MoogleUK
Joined:
Posts:
2
Location:
UK

Hi Martin,

Thanks for looking at this. Just tried the exclude way and thats worked perfectly for me :)

Thank you so much, makes it a lot easier for me!

Richard

Reply with quote

Advertisement

You can post new topics in this forum