Topic "FTP Sync Download and Delete"

Author Message
Xekei
[View user's profile]

Joined: 2013-09-03
Posts: 5
Location: Czech Republic
Hello

I want to apologize in advance for my English is not very good.
Getting Started with WinSCP and I need advice...

I want to run a script automatically at an interval of every 60 minutes

- Connect to the FTP server (TLS Explicit)
- Download all the files in a folder
- After downloading a file to an FTP server, delete

Can anyone be so helpful and give an example of a script and how to use it thank you
Advertisements
sgarciav

Guest


Hi,

I have a nee similar to yours. I looked at the documentation for WinSCP and fund this list of commands:

https://winscp.net/eng/docs/scripting#commands

The command to delete a remote file is rm. Then if you scroll down further you'll see an example that transfers a file from the FTP server to the local machine (then transfers it back). You can use this example, minus the second part. Just use the rm statement after the get command and before the close command.

Also, since you want o transfer many files, use the mget command with *.* instead of "get" and use the rm also with the *.* wildcards.

I wish that this could work for my situation. In my case files are continuously added to the FTP server, so if I use rm *.* I might delete files that came in after the mget process started and were not transferred to the local machine. Good luck, Salvador
sgarcia

Guest


Also, I just found this forum entry:

https://winscp.net/forum/viewtopic.php?p=46736#46736

It might be exactly what we are both looking for. Salvador



Xekei wrote:
Hello

I want to apologize in advance for my English is not very good.
Getting Started with WinSCP and I need advice...

I want to run a script automatically at an interval of every 60 minutes

- Connect to the FTP server (TLS Explicit)
- Download all the files in a folder
- After downloading a file to an FTP server, delete

Can anyone be so helpful and give an example of a script and how to use it thank you
Xekei
[View user's profile]

Joined: 2013-09-03
Posts: 5
Location: Czech Republic
Thanks for the answer

I had a lot of work and I could not answer before


I am trying to use the command "get -delete *.*" This command deletes but folders and subfolders
I want to folders and subfolders maintained (not deleted)

What command should I use?
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25014
Location: Prague, Czechia
You should better describe your requirements.
Do you want to download (and delete) the files in subfolders?
Or do you want to download (and delete) only files exactly in download directory (but not in its subfolders)?
_________________
Martin Prikryl
Xekei
[View user's profile]

Joined: 2013-09-03
Posts: 5
Location: Czech Republic
prikryl: Dobr den,

Budu pst česky protoe moje angličtina nen dobr a nedoku popsat přesně o co se snam.


Chci spoutět skript automaticky v intervalu jednou za 60 minut
Aby se v kořenovm adresři i ve slokch a podslokch na serveru kde se nachz soubory vechny přesunuli do
loklnch sloek a podsloek kter jsou shodn (Shodn myslm umstěn a nzvy sloek)

(Jestli to řkm dobře snam se o jednosměrnou synchronizaci)

Soubory kter chci přesouvat maj vygenerovan jmno take nemohu přesouvat určit soubory podle jmna



Přklad:

Kdy bude na serveru sloka kter bude mt nzev "xxx" a v n bude soubor "1.txt"
A v loklnm adresři bude taky sloka s nzvem "xxx"

Skript pole soubor 1.txt do sloky "xxx" v loklnm adresři
Soubor se přesune take na serveru bude tento soubor smazan (po kompletnm přesunut)

Tohle chci ale pro vce sloek a souborů


Děkuji za odpověď...


PS: Děkuji za vvoj tohoto programu
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25014
Location: Prague, Czechia
A v cem je problem? Tohle dela get -delete.
Nebo potrebujes aby vzdaleny adresar xxx zustal zachovan? (get -delete ho smaze).
_________________
Martin Prikryl
Xekei
[View user's profile]

Joined: 2013-09-03
Posts: 5
Location: Czech Republic
Velice děkuji za odpověd ano potřebuji aby byl adresř prvě zachovn Sad

Jde to nějak udělat aby sloka byla zachovna ?


EDIT:
Jestli tato monost neexistuje bylo by mon j přidat do beta verze ?
nějak přkaz kter nemae sloky a podsloky...


Podle mě by bylo nejlep kdyby ve vchozm nastaven se sloky nemazaly přkazem "get -delete"
a při přdan nějakho přkazu byly zahrnuty sloky kdo by je chtěl tak mazat
Xekei
[View user's profile]

Joined: 2013-09-03
Posts: 5
Location: Czech Republic
Stle řem tento problm můete pane Přikryl prosm odpověď děkuji
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25014
Location: Prague, Czechia
Xekei wrote:
Velice děkuji za odpověd ano potřebuji aby byl adresř prvě zachovn Sad

Jde to nějak udělat aby sloka byla zachovna ?

Ne automaticky. Samozrejme si muzes naimplementovat rekurzivni prochazeni a mazani souboru sam. Zvlast pred WinSCP .NET assembly to neni slozite.
_________________
Martin Prikryl
HomerSimpsons
[View user's profile]

Joined: 2013-10-03
Posts: 1
Dobr večer,

Řem naprosto stejn problm, ale bohuel neumm programovat a nevm ani co znamen "naimplementovat rekurzivni prochazeni" a u vůbec nevm co mm dělat "WinSCP .NET"

byl by někdo tak ochotn a pomohl by mě s tm?
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25014
Location: Prague, Czechia
HomerSimpsons wrote:
Řem naprosto stejn problm, ale bohuel neumm programovat a nevm ani co znamen "naimplementovat rekurzivni prochazeni" a u vůbec nevm co mm dělat "WinSCP .NET"

byl by někdo tak ochotn a pomohl by mě s tm?

Samozrejme nevylucuji ze ti nekdo pomuze. Jen chci poznamenat, ze zde neprovozujeme programovaci sluzbu.
_________________
Martin Prikryl
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