Discussion:
How to mirror (with FXP) specific dir
Hernan Lopes
2013-05-05 22:12:47 UTC
Permalink
I want to transfer
from FTPSOURCE: /some/dirs/This-Dir-Source
into FTPDESTINY: /some/other/dirs/This-Dir-Destiny

I can do it in one w ?ay that i know of:
slot FTPDESTINY; mkdir /some/other/dirs/This-Dir-Destiny; cd
/some/other/dirs/This-Dir-Destiny;
slot FTPSOURCE; mirror /some/dirs/This-Dir-Source slot:FTPDESTINY

Ok, that works but i think it looks awful.
The problem with the approach above is if i have many of those commands, i
have a feeling that lftp will get lost because the commands are not chained
somehow. For example, when i execute the cmd aboce, imagine FTPDESTINY is
busy at the time i try:

slot FTPDESTINY; mkdir /some/other/dirs/This-Dir-Destiny; cd
/some/other/dirs/This-Dir-Destiny;

Then, FTPDESTINY was busy and conclusion: none of those commands were
executed and i am at directory /the/wrong/directory/

And then comes the next command which is:

slot FTPSOURCE; mirror /some/dirs/This-Dir-Source slot:FTPDESTINY

And BAAAM, its going to mirror into /the/wrong/directory/

So to solve this, i think the whole tihng should be passed all together
within one command so either the whole thing works or none of it... at
least it will always act correctly.

Here is my sugested command:

mirror --source-slot=FTPSOURCE --source-dir=/some/dirs/This-Dir-Source
--destiny-slot=FTPDESTINY --destiny-dir=/some/other/dirs/This-Dir-Destiny


What do you guys think?
Is this safe way possible already
Alexander Lukyanov
2013-05-06 13:17:34 UTC
Permalink
Use "&&" or "set fail-exit yes".

BTW, mirror automatically creates the target directory and you can specify
target URL directly without any slots.
--
Alexander.
Post by Hernan Lopes
slot FTPDESTINY; mkdir /some/other/dirs/This-Dir-Destiny; cd
/some/other/dirs/This-Dir-Destiny;
Then, FTPDESTINY was busy and conclusion: none of those commands were
executed and i am at directory /the/wrong/directory/
slot FTPSOURCE; mirror /some/dirs/This-Dir-Source slot:FTPDESTINY
And BAAAM, its going to mirror into /the/wrong/directory/
So to solve this, i think the whole tihng should be passed all together
within one command so either the whole thing works or none of it... at
least it will always act correctly.
Alexander Lukyanov
2013-05-13 12:12:22 UTC
Permalink
lftp reconnects as needed, so you don't have to keep those connections open
all the times.

If the connections are anonymous, you can just do:
mirror URL1 URL2

If a login/password is required, you have to login first so that lftp
remembers the password. Them you can use the URL without a password.
login ftps://***@host
mirror ftps://***@host URL2

You can also use bookmarks to remember those URLs and refer to them by name:
bookmark add site1 URL1
bookmark add site2 URL2
mirror bm:site1 bm:site2
Could you give an example?
My intent is to connect to many ftps.. and leave them open/idling
connected, and i will keep sending those commands to transfer dirs from
some source into some destiny
Post by Alexander Lukyanov
Use "&&" or "set fail-exit yes".
BTW, mirror automatically creates the target directory and you can
specify target URL directly without any slots.
--
Alexander.
Post by Hernan Lopes
slot FTPDESTINY; mkdir /some/other/dirs/This-Dir-Destiny; cd
/some/other/dirs/This-Dir-Destiny;
Then, FTPDESTINY was busy and conclusion: none of those commands were
executed and i am at directory /the/wrong/directory/
slot FTPSOURCE; mirror /some/dirs/This-Dir-Source slot:FTPDESTINY
And BAAAM, its going to mirror into /the/wrong/directory/
So to solve this, i think the whole tihng should be passed all together
within one command so either the whole thing works or none of it... at
least it will always act correctly.
Loading...