Re: need a little with renaming files
Dave B schreef:
> On Saturday 19 April 2008 23:27, mop2 wrote:
>
>> I think this is what you want:
>>
>> #!/bin/bash
>> mv -iv "$1" "${1/.wav/}" # "i" = interative if destination exists
>
> Given that sometimes audio files tend to have, so to speak, particular or
> funny names, maybe a safer one could be this:
>
> mv -i -- "$1" "${1%.wav.mp3}.mp3"
>
> or, with bash+GNU mv
>
> mv -iv -- "$1" "${1/%.wav.mp3/.mp3}"
>
yes, i did already have the quotes around my filenames, because of the
spaces in the filenames...
anyway, the "${1/%...." option, is new to /me, and ed a lot
i have to read the 'man bash' page again, i think,
and this time try to read the whole story
so, not stop before the lines about 'Parameter Expansion' (line 756-)
... ;-)
thanks for the answers!
--
Luuk
|