Peterborough Linux User Group (Canada) Forum

Linux & Android => Support => Topic started by: ssfc72 on August 01, 2020, 07:49:55 PM

Title: rename command - need help
Post by: ssfc72 on August 01, 2020, 07:49:55 PM
Ok, I am trying to rename a batch of 93 files. See attached text file, which is a partial copy of the directory.

I have looked up how to use the rename command but I am getting errors when I try to get it to do the rename operation.
I use wild cards, in the command to try and get it to do all 93 files at once.

Anyone see what I am doing wrong?  I was trying only to rename only 1 file, as a test.
Title: Re: rename command - need help
Post by: Jason on August 02, 2020, 03:45:28 PM
I hadn't heard of rename. Usually you rename files in Linux using the the 'mv' command. I'll look into this and get back to you unless you're already figured it out.

I should mention that you can't just use wildcards to batch rename them which is probably why you're getting an error. You have to use a loop.
Title: Re: rename command - need help
Post by: ssfc72 on August 02, 2020, 05:41:54 PM
Success!   I downloaded the File Manager, Thunar.  Works excellent, once I found a help page for it,
Thanks for the offer of help, Jason.

http://www.webupd8.org/2016/03/quickly-batch-rename-files-in-linux.html
Title: Re: rename command - need help
Post by: Jason on August 02, 2020, 05:57:34 PM
Well, that's no fun at all!  ;D I'm still working on it in the Command-Line Interface (CLI). And before you say it, shutup Buster. I like figuring out things.
Title: Re: rename command - need help
Post by: William on August 04, 2020, 04:35:50 PM
Quote from: ssfc72 on August 01, 2020, 07:49:55 PM
rename 's/ *Track 3.mp3/Track3.mp3' *.mp3

Try adding / at the end of pattern, like 's/ *Track 3.mp3/Track3.mp3/'.
Title: Re: rename command - need help
Post by: ssfc72 on August 05, 2020, 01:41:25 PM
Thanks William.  I will have to try that, to see if it works.