Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

AZhappyjack

macrumors G3
Original poster
Jul 3, 2011
9,623
22,751
Happy Jack, AZ
I am trying to rename a folder full of files (over 300 files) with names in the format:

YYYYMMDD-something-descriptive-goes-here.mp3

to

YYYYMMDD.mp3

All of the batch utilities that I've seen can add text or replace text, but so far I have not found one that will truncate text to a specific length. The ones that do remove text will only remove a set number of characters from either end of the file (beginning or end). In my case, these file names are variable in length, so they don't work.

Any ideas?
 

HenryAZ

macrumors 6502a
Jan 9, 2010
690
143
South Congress AZ
I am trying to rename a folder full of files (over 300 files) with names in the format:

YYYYMMDD-something-descriptive-goes-here.mp3

to

YYYYMMDD.mp3

All of the batch utilities that I've seen can add text or replace text, but so far I have not found one that will truncate text to a specific length. The ones that do remove text will only remove a set number of characters from either end of the file (beginning or end). In my case, these file names are variable in length, so they don't work.

Any ideas?

Better Rename will do this easily. Truncate file name only to x number of characters. As long as your date strings are a consistent set number of characters, easy. Just pick the 'Truncate' function.
 
  • Like
Reactions: AZhappyjack
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.