Hi,

I had been working on this script back in March/April and then stopped.
Well, I'm back on it now. Could anyone please help me in refining this
small scripting problem, as below, within lftp?

"In my bash script to run lftp this bit \"$(basename "${f%.*}")*\" always
returns nothing so my mirror command results in mirror - I *

Can you please advise what is wrong? I have tried a few things but my
scripting experience is limited."

Thanks again


On 16 April 2011 10:49, Daniel Freeman <[email protected]> wrote:

> Can anyone help with this?
>
>
> On 26 March 2011 18:27, Daniel Freeman <[email protected]> wrote:
>
>> Thanks.
>>
>> That command works fine on a normal bash command line.
>>
>> In my bash script to run lftp this bit \"$(basename "${f%.*}")*\" always
>> returns nothing so my mirror command results in mirror - I *
>>
>> Can you please advise what is wrong? I have tried a few things but my
>> scripting experience is limited.
>>
>> Thanks again
>>
>>
>> 2011/3/5 Daniel Fazekas <[email protected]>
>>
>>> 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. :)
>>>
>>
>>
>>
>
_______________________________________________
lftp mailing list
[email protected]
http://univ.uniyar.ac.ru/mailman/listinfo/lftp

Reply via email to