Sample Header Ad - 728x90

Batch rename of files that share the same prefix

-1 votes
2 answers
132 views
I have a list of files on my server with a prefix that I want to de-dupe. These are completely different generated files. It seems to be generated files with
{Title} - {yyyy-MM-dd}_{random} - {Description}.ts
For example:
Camera Recording - 2023-08-11_14 - Front Deck.ts
Camera Recording - 2023-08-11_14 - Back Deck.ts
Camera Recording - 2023-08-16_27 - Front Deck.ts
Camera Recording - 2023-08-16_36 - Front Deck.ts
Camera Recording - 2023-08-17_56 - Front Deck.ts
I need to be able to run a script that identifies duplicate prefixes of the following filesnames. Then changes the number prefix {random} part after the date
Camera Recording - 2023-08-11_14 - Front Deck.ts
Camera Recording - 2023-08-11_14 - Back Deck.ts
To become the following, the {random} needs to be replaced with a different value (other than 14)
Camera Recording - 2023-08-11_14 - Front Deck.ts
Camera Recording - 2023-08-11_68 - Back Deck.ts
Any advice on how to achieve this with a linux shell script?
Asked by mysterio21_troy (11 rep)
Jan 8, 2024, 08:50 PM
Last activity: Feb 8, 2024, 10:09 AM