Multiple File types in Various Folders

Advertisement

theMezz
Joined:
Posts:
6
Location:
CNY

Multiple File types in Various Folders

I am trying to learn how to create a few scripts via trial and error, reading, testing, Etc.

The get command seems pretty logical for multiple file types. Nore that the open is working and the get I can works towards what I need to do.
get -delete   *.txt *.log *.doc
Now this is the hard part ... I need to download all the txt, log and doc files - but they exist in various folders. So I need the get to look in all sub folders. The sub folders change names daily as new ones are created. Then I need the leftover files as well as the folders deleted.

So ..

Today
folder1 has a few files some are *.log ... ok download then
folder2 has a few files some are *.txt ... ok download that
then delete folder 1 and 2

tomorrow
folder34 has a few files some are *.exe ... ok do not download those
folder62 has a few files some are *.doc ... ok download that
then delete folder 34 and 62

So the folder names and file names and types change daily ... but all I wat downloaded is that *.txt *.log *.doc files...

I know .. this must be easy if I knew how! :-)[/m]

Reply with quote

Advertisement

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

Re: Multiple File types in Various Folders

If you want to download the files to the same local folder (not reproducing the remote directory structure locally), then it is actually not easy.
See Downloading all files from FTP/SFTP to the same local folder

Btw, your get syntax is wrong. It misses destination (which is mandatory, when multiple sources are used):
get -delete *.txt *.log *.doc c:\target\path\*
https://winscp.net/eng/docs/scriptcommand_get#remarks

Reply with quote

Advertisement

You can post new topics in this forum