-1

I have a bunch of mp3 files that iTunes copied over adding a numeric extension, that I want to remove. Is there a Mac bash command that will allow me to do that? Here is what the directory looks like. The files in question have 2 digits, and a space.

enter image description here

1
  • What is your research effort? What have you tried? Where are you stuck? "Gimme code" does not constitute a good question. My hint: vidir. You may get answers tailored to your specific request but in general I find the tool quite useful for renaming. Dec 30, 2019 at 18:44

2 Answers 2

1

Looks like a duplicate of:

remove numbers from filenames in Mac OS X

Modify the answer from there:

for name in *; do mv -v "$name" "${name#[0-9]* }"; done

I would first move 1 or 2 files into their own directory and try running that. If you get the desired results, then go into your main music directory and run it again.

0

There is rename command in linux which you can use.

rename 's/^[0-9][0-9] //' *.mp3

The above command matched all the .mp3 files starting with two numbers followed by space. Check this link or man page for more details. I'm not sure if this command is available for mac.

1
  • The question is for Mac and maybe rename is well defined there (I cannot tell). In general in *nix there are many similar programs and rename in one distro may be different than rename in another distro. Dec 30, 2019 at 20:09

Not the answer you're looking for? Browse other questions tagged or ask your own question.