downloading specific folder

Advertisement

dodger2015
Guest

downloading specific folder

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

Reply with quote

Advertisement

Dodger2015
Guest

Windows task manager error

Solved that problem with TIMESTAMP%%. Happy days :)

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.

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
27,227
Location:
Prague, Czechia

Re: Windows task manager error

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

Reply with quote

matrixtan
Guest

Downloading specific file from folder

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.

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
27,227
Location:
Prague, Czechia

Re: Downloading specific file from folder

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.

Reply with quote

Advertisement

You can post new topics in this forum