How do I rename a bunch of recordings using wildcards?
How do I rename a bunch of recordings using wildcards?
I'm trying to rename a bunch of recordings, the same way (*Album *.* --> *Albums *.*), without having to do each rename separately.
How can I do that? I can't install mmv or rename (no apt command), and mv doesn't work, so what can I do?
Thanks for any help.
How can I do that? I can't install mmv or rename (no apt command), and mv doesn't work, so what can I do?
Thanks for any help.
-
- Wizard God
- Posts: 32709
- Joined: Tue Sep 04, 2007 13:49
- Location: Canberra; Black Mountain Tower transmitters
Re: How do I rename a bunch of recordings using wildcards?
You can do it in a shell for loop.
Peter
T4 HDMI
U4, T4, T3, T2, V2 test/development machines
Sony BDV-9200W HT system
LG OLED55C9PTA 55" OLED TV
T4 HDMI
U4, T4, T3, T2, V2 test/development machines
Sony BDV-9200W HT system
LG OLED55C9PTA 55" OLED TV
Re: How do I rename a bunch of recordings using wildcards?
I believe this will do it:
Code: Select all
for name in *Album\ *; do mv "$name" "${name/Album/Albums}"; done
-
- Wizard God
- Posts: 32709
- Joined: Tue Sep 04, 2007 13:49
- Location: Canberra; Black Mountain Tower transmitters
Re: How do I rename a bunch of recordings using wildcards?
Something like this:
That version prints what would be done:
To make it actually rename the files, change echo mv to mv.
The quoting in the mv command has to be there (the filenames will contain spaces), and has to use double quotes, not single quotes.
Code: Select all
for fn in *'News '*.*; do
echo mv "$fn" "${fn/New/Old}"
done
Code: Select all
mv 20201206 1857 - ABC - ABC News Sunday.eit 20201206 1857 - ABC - ABC Olds Sunday.eit
mv 20201206 1857 - ABC - ABC News Sunday.ts 20201206 1857 - ABC - ABC Olds Sunday.ts
mv 20201206 1857 - ABC - ABC News Sunday.ts.ap 20201206 1857 - ABC - ABC Olds Sunday.ts.ap
mv 20201206 1857 - ABC - ABC News Sunday.ts.cuts 20201206 1857 - ABC - ABC Olds Sunday.ts.cuts
mv 20201206 1857 - ABC - ABC News Sunday.ts.meta 20201206 1857 - ABC - ABC Olds Sunday.ts.meta
mv 20201206 1857 - ABC - ABC News Sunday.ts.sc 20201206 1857 - ABC - ABC Olds Sunday.ts.sc
The quoting in the mv command has to be there (the filenames will contain spaces), and has to use double quotes, not single quotes.
Peter
T4 HDMI
U4, T4, T3, T2, V2 test/development machines
Sony BDV-9200W HT system
LG OLED55C9PTA 55" OLED TV
T4 HDMI
U4, T4, T3, T2, V2 test/development machines
Sony BDV-9200W HT system
LG OLED55C9PTA 55" OLED TV
Re: How do I rename a bunch of recordings using wildcards?
Thank you adoxa. That's perfect.adoxa wrote: ↑Wed Feb 03, 2021 10:07I believe this will do it:
Code: Select all
for name in *Album\ *; do mv "$name" "${name/Album/Albums}"; done
Thanks prl.prl wrote: ↑Wed Feb 03, 2021 10:10Something like this:That version prints what would be done:Code: Select all
for fn in *'News '*.*; do echo mv "$fn" "${fn/New/Old}" done
To make it actually rename the files, change echo mv to mv.Code: Select all
mv 20201206 1857 - ABC - ABC News Sunday.eit 20201206 1857 - ABC - ABC Olds Sunday.eit mv 20201206 1857 - ABC - ABC News Sunday.ts 20201206 1857 - ABC - ABC Olds Sunday.ts mv 20201206 1857 - ABC - ABC News Sunday.ts.ap 20201206 1857 - ABC - ABC Olds Sunday.ts.ap mv 20201206 1857 - ABC - ABC News Sunday.ts.cuts 20201206 1857 - ABC - ABC Olds Sunday.ts.cuts mv 20201206 1857 - ABC - ABC News Sunday.ts.meta 20201206 1857 - ABC - ABC Olds Sunday.ts.meta mv 20201206 1857 - ABC - ABC News Sunday.ts.sc 20201206 1857 - ABC - ABC Olds Sunday.ts.sc
The quoting in the mv command has to be there (the filenames will contain spaces), and has to use double quotes, not single quotes.
Re: How do I rename a bunch of recordings using wildcards?
I've changed the names using putty, but the changes aren't showing up on the T4's list of recordings. I've restarted the GUI and rebooted the T4, neither of which helped.
What's going on, and how can I get the changes showing in the list of the T4's recordings?
What's going on, and how can I get the changes showing in the list of the T4's recordings?
Re: How do I rename a bunch of recordings using wildcards?
ETA_2016 wrote: ↑Thu Feb 04, 2021 21:22I've changed the names using putty, but the changes aren't showing up on the T4's list of recordings. I've restarted the GUI and rebooted the T4, neither of which helped.
What's going on, and how can I get the changes showing in the list of the T4's recordings?
The filenames displayed in media player are derived from the .meta file. You need to edit each .meta file to amend the displayed names.
__________________________________
Paul
Beyonwiz T4, 2 x U4: FW - 19.3 20211010
Samsung QA85Q80BAWXXY 4K TV
Samsung QA65Q80TAWXXY 4K TV
Samsung HW Q800BXY soundbar
OverlayHD 1.70, IceTV, Foxtel IQ4
2 x Win7 PCs, 2 x Win10 PCs
Denon AVR -X2400H
Paul
Beyonwiz T4, 2 x U4: FW - 19.3 20211010
Samsung QA85Q80BAWXXY 4K TV
Samsung QA65Q80TAWXXY 4K TV
Samsung HW Q800BXY soundbar
OverlayHD 1.70, IceTV, Foxtel IQ4
2 x Win7 PCs, 2 x Win10 PCs
Denon AVR -X2400H
Re: How do I rename a bunch of recordings using wildcards?
The name in the list comes from the meta file. Assuming Album doesn't occur in the description (or it doesn't matter if it does), try this:
Code: Select all
sed -i "s/Album /Albums /" *Albums\ *.meta