On 02/28/2011 09:12 PM,
joe@actionline.com wrote:
> When I download images and ".MOV" files from digikam
> the file names all have a leading hyphen. I've been
> able to convert -filename.png files to filename.jpg
> but when I try to use 'mv' to rename -filename.MOV files
> to filename.MOV or filename.mov without the leading
> hyphen, it does not work.
>
> How can I rename these .MOV files to remove the leading
> hyphen (-) and to change the .MOV suffix to .mov ?
You can prefix with the path:
bash$ mv ./-file.png file.png
This could also be wrapped in a shell loop:
for fname in -*.png; do mv ./"${fname}" "${fname/#-/}"; done
to do multiple files with leading "-" characters. Note this will
cold-heartedly tromp any existing files with the non-leading-dash
if they exist beforehand.
Some GNU commands will also take "--" to mean "ignore any
option-looking things after this" so you might be able to get
away with
bash$ mv -- -file.png file.png
though I don't think "mv" is among the commands that do that.
-tim
---------------------------------------------------
PLUG-discuss mailing list -
PLUG-discuss@lists.plug.phoenix.az.us
To subscribe, unsubscribe, or to change your mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss