Discussion:
lftp mirror not removing directories...
Chris Richards
2013-06-25 03:16:27 UTC
Permalink
Hi LFTP Members,

This is my first post, I can't remember the last time I joined a mailing list for support... Nearly all done in forums now. You guys are keeping it "old school" :)

I have LFTP setup on my QNAP NAS which downloads files from my external media server, it works great for the most part.

One small issue I have noticed is that directories on the server are not being removed, all the files in the directories are being removed though.

Example:
/downloads/_send_home/other/testdir1/testfile1
/downloads/_send_home/other/testdir1/testfile2
/downloads/_send_home/other/testdir1/testfile3

If I ran my script on the above files "testfile1, testfile2, testfile3" would be removed but directory "testdir1" would remain.

I have 3 subdirectories that get mirrored: "/downloads/_send_home/other", "/downloads/_send_home/media1" and "/downloads/_send_home/media2"

I doubt its a permissions issue as I login as the file/directory owner plus some files are being removed. The file/directory permissions are 777.

My LFTP settings are below.

Thanks.

-Chris

----------
<snip>
remote_dir=/downloads/_send_home/
local_dir=/share/Multimedia/tmp/_send_home/

<skip a few>

/opt/bin/lftp -u $login,$pass $host << EOF
set ftp:ssl-allow no
set mirror:set-permissions off
set mirror:use-pget-n 2
set net:limit-total-rate 500:0
mirror --Remove-source-files -X .* -X .*/ -c --log=/share/Download/logs/downloads-sync-lastrun.log $remote_dir $local_dir
quit
EOF
</snip>
----------
Alexander Lukyanov
2013-07-02 16:21:58 UTC
Permalink
--Remove-source-files removes only plain files, not directories. It's done
that way because the direcories could contain other files which were not
downloaded (e.g. because they were excluded or they are present locally
already).
Post by Chris Richards
One small issue I have noticed is that directories on the server are not
being removed, all the files in the directories are being removed though.
mirror --Remove-source-files -X .* -X .*/ -c
Post by Chris Richards
--log=/share/Download/logs/downloads-sync-lastrun.log $remote_dir $local_dir
Loading...