Winscp download files newer than 7 days






















It only takes a minute to sign up. Connect and share knowledge within a single location that is structured and easy to search. Sure I can write some script on perl etc but I feel it's overkill. Any UNIX way? Separate utility? This question is very old but I still wanted to add my bash only solution as I was just searching for one when I came here.

The grep tar in the listing command is just for my own purpose to list only tar files, can be adapted of course. This deletes all tar files in the given directory except the last 7 ones. It is not considering the date though but if you only have one backup per day it is good enough. You don't need a script to achieve the intended effect - a one-liner will do if you have shell access to send a command:.

Batch mode "-b" switch should help you out. It reads sftp commands from file. Nothing worked for me from above answers.

Especially when you limited by password and cannot use private key for sftp utility. I have found good script using lftp gist. Sign up to join this community.

The best answers are voted up and rise to the top. Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Learn more. Sign up to join this community. The best answers are voted up and rise to the top. Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams?

Learn more. Asked 11 years, 1 month ago. Active 4 years, 5 months ago. Viewed 1k times. Improve this question. Martin Prikryl 6, 2 2 gold badges 35 35 silver badges 71 71 bronze badges. Konstantin Petrukhnov Konstantin Petrukhnov 1 1 gold badge 1 1 silver badge 5 5 bronze badges. Add a comment. For that you can use file mask with time constraint. In WinSCP. NET assembly , use TransferOptions. PowerShell example:.

In some cases you cannot rely on some artificially determined timestamp. In such case, you can remember the last run time, or even better the timestamp of the latest file processed in the last run, and use that timestamp as the threshold for the consecutive run.

The following snippet shows, how to implement a continuously running PowerShell script that fetches new files:.



0コメント

  • 1000 / 1000