Friday, November 13, 2009

lftp and Empty Directories

OK. Still working on this
one.

My problem? lftp tends to
hang when I try to backup
up empty directories using
the mirror command.

For rexample:

mirror -c empty_dir


The above command will not
work on some ftp servers.
Don't know why.

I said it hangs. Actually,
that is not true. It does
not hang. It just gets stuck
in a loop and never goes on.
It keeps trying to get something
and keeps failing.

OK

Could not get this suggestion
to work:

Suggested lftp empty directory fix

Looks like I may have to back up
each directory under lftp by hand.

That is to say, backup the empty and
non-empty directories separately.

There's got to be a better way!

I've tried adding an empty directory
to my own website at bluehost.com.

Seems that lftp backs up the directory
just fine. lftp has no problem backing
up empty directories on what must surely
be a linux server.

So, there must be an option that will do
the trick!

Here's what things look like in debug mode
on the ftp server that hangs
(loops endlessly):

---> CWD /etc
<--- 250 CWD command successful      
---> PASV
<--- 227 Entering Passive Mode (198,170,118,103,117,178). 
---- Connecting data socket to (198.170.118.103) port 30130
---- Data connection established                            
---> LIST -a
<--- 150 Opening ASCII mode data connection for file list 
---- Got EOF on data connection
---- Closing data socket
<--- 226 Transfer complete.                               
---> PASV
<--- 227 Entering Passive Mode (198,170,118,103,117,245). 
---- Connecting data socket to (198.170.118.103) port 30197
---- Data connection established                            
---> NLST
<--- 450 : Permission denied                              
---- Closing data socket
---> PASV                                               
<--- 227 Entering Passive Mode (198,170,118,103,117,245). 
---- Connecting data socket to (198.170.118.103) port 30197
---- Data connection established                            
---> NLST
<--- 450 : Permission denied                              
---- Closing data socket
---> PASV                                               
<--- 227 Entering Passive Mode (198,170,118,103,117,227). 
---- Connecting data socket to (198.170.118.103) port 30179
---- Data connection established                            
---> NLST
<--- 450 : Permission denied                              
---- Closing data socket
---> PASV                                               
<--- 227 Entering Passive Mode (198,170,118,103,117,140). 
---- Connecting data socket to (198.170.118.103) port 30092
---- Data connection established                            
---> NLST
<--- 450 : Permission denied                              
---- Closing data socket
---> PASV                                               
<--- 227 Entering Passive Mode (198,170,118,103,117,54).  
---- Connecting data socket to (198.170.118.103) port 30006
---- Data connection established                            
---> NLST
<--- 450 : Permission denied                              
---- Closing data socket
---> PASV                                               
<--- 227 Entering Passive Mode (198,170,118,103,117,57).  
---- Connecting data socket to (198.170.118.103) port 30009
---- Data connection established                            
---> NLST
<--- 450 : Permission denied                              
---- Closing data socket
---> PASV                                               
<--- 227 Entering Passive Mode (198,170,118,103,117,68).  
---- Connecting data socket to (198.170.118.103) port 30020
---- Data connection established                            
---> NLST
<--- 450 : Permission denied                              
---- Closing data socket
Interrupt                                               
---- Closing idle connection
---> QUIT
<--- 221 
---- Closing control socket
>


At last! I found the answer. So
simple.

Here's the command I used:

lftp -u yourusername,yourpassword 
         ftp.yourdomain.com -e "set ftp:list-empty-ok yes"

I've broken the above one line into
two lines so that my blog software
does not have a problem.

Note that the above two lines is just
one line that I've typed to log into
the ftp server via lftp.

Note this part here:

-e "set ftp:list-empty-ok yes"

That's the part where I say empty
directories are OK. I guess that's
what lftp needs to know in this case.

Voila! It works!

After typing the above login line to
get into the ftp server, the line
given below now backs up the entire
website flawlessly:

mirror -c



Ed Abbott

No comments:

Post a Comment