On Mar 5, 2011, at 02:18, Daniel Freeman wrote:
> Firstly I'm mirroring a remote directory with index files like "song.index"
> to a local directory.
mirror -I *.index
That's an uppercase āIā as in include.
-X or --exclude-glob is the opposite, as you could see in the lftp man page.
If they are all in one directory, you could also use mget:
mget *.index
> Then for each index file I want to take its name ie "song" and use this to
> only include mirror files that start with "song".
> I appreciate if you can help with this. Otherwise I would have to do a local
> directory listing and construct the include list manually.
If you downloaded the files locally in the previous step anyway, I don't see
why executing some commands on the local system would hurt. At the lftp command
line, you can simply prefix a line with an exclamation mark and it gets
executed as a local shell command. So for a *nix system with a bash shell, you
could write:
!find . -type f -name '*.index' | while read -r f; do echo mirror -I
\"$(basename "${f%.*}")*\"; done | sort | uniq > /tmp/lftp-mirror-cmds
source /tmp/lftp-mirror-cmds
Making the above commands safe if the "*.index" prefixes could have special
characters (line feed, ", etc) in their names is an exercise left to you. :)