Topic "downloading specific folder"

Author Message
dodger2015

Guest


Hi Guys,

Hope somebody can help, this has been bugging me for two days now.
ive searched through the posts concerning but each one gets me a little more confused.

I simply want to download a cpanel backup automatically to my home pc every day,
so far I have the script below which downloads everything in the backups folder but I want to just download the accounts folder.

My problem is one of the folder names changes to the current date every day.
ie:
/backup/2015-04-16/accounts

so the date part changes to the next day every day, and its just the accounts folder I want to download.

I believe this is what I need:
$stamp = $(Get-Date -f "yyyyMMdd")
but I cant get it to work what ever I do.

any ideas what I need to do would be appreciated, thank you.


option batch abort
option confirm off
open sftp://USERNAME:PASSWORD@0.0.0.0:34567
cd /backup
option transfer binary
get *.* C:\Users\homepc\Desktop\FTP-site-backups\
close
Advertisements
Dodger2015

Guest


Solved that problem with TIMESTAMP%%. Happy days Smile

I have a new problem now though.. Windows task manager still shows the task as running
After the files have all downloaded.. So the PC will not go to sleep because of this.

Has anyone come across this before?

Thank you.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24991
Location: Prague, Czechia
Dodger2015 wrote:
I have a new problem now though.. Windows task manager still shows the task as running
After the files have all downloaded.. So the PC will not go to sleep because of this.

Has anyone come across this before?

You are missing exit command at the end of the script.
_________________
Martin Prikryl
matrixtan

Guest


Hi,

How can I download 3 files from the same folder. The file has a different date everyday i.e XXX_05082015. Need to download the file with T-2 workday. i.e XXX_05082015. What is the correct code to use?

Regards.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24991
Location: Prague, Czechia
matrixtan wrote:
How can I download 3 files from the same folder. The file has a different date everyday i.e XXX_05082015. Need to download the file with T-2 workday. i.e XXX_05082015. What is the correct code to use?

You can use a filemask with time-constraint:
https://winscp.net/eng/docs/file_mask#size_time
Like get *<2D>=3D = download all files newer than 3 days but older than 2 days.
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