Synchronize only Directories from the last day

Advertisement

mike94
Joined:
Posts:
7
Location:
London

Synchronize only Directories from the last day

I know you can apply a filemask for files, so you can only get the files from the last 24h, 2days, etc.. Can the same thing be achieved with Directories, so the script can only download the directories (with all files inside), which match the desired timeframe?

Reply with quote

Advertisement

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

Re: Synchronize only Directories from the last day

The WinSCP file mask time constraint applies to files only.

Is this related to your other post?
Synchronize & Compare files only older than "X"
As there your folders are named by their creation date. That can be used in WinSCP, like:
synchronize -filemask=%TIMESTAMP-1D#yyyy.mm.dd%/ local C:\test /mnt/backups
See https://winscp.net/eng/docs/scripting#timestamp

Reply with quote

mike94
Joined:
Posts:
7
Location:
London

Re: Synchronize only Directories from the last day

Hi Martin,

I just want to say a big thank you, the code which you included did the trick and I have finally managed to achieve what I was looking for a very long time. The script now connects to the remote location and it only downloads the files from the current day or from as many days as I need.

I used to synchronize the files to a NAS, but now I have found a software which maps Dropbox as a local drive, so I can use WinSCP to synchronize the files straight to Dropbox, which is purely amazing! I had a small problem with this when I was getting some weird access denied errors, but I have managed to resolve it by disabling transfer resume/transfer to temporary filename.

This post is related to my other post, but since I have achieved what I was after, we can now close both topics.

Reply with quote

Advertisement

You can post new topics in this forum