Is there a linux command like mv but with regex?

For example I want to mv (.*?).sql $1.php, is there a command that lets me specify renaming patterns? Answer As others have mentioned, rename is good at this, but read the man page (man rename) before you try it. There are at least two entirely different tools out there called rename and which one you … Read more

Renaming many files in Mac OS X, batch processing

I used to rename file in Linux via a rename command: rename ‘s/old_pattern/new_pattern/g’ *glob Is there something similar in Mac OS X (Snow Leopard)? Answer With Homebrew, a package manager for OS X: brew install rename Then you can run the same rename commands as in Linux. AttributionSource : Link , Question Author : math … Read more

Is there a way to batch rename files to lowercase?

I need a way to rename all files in folders and subfolders to lowercase. I’d like to know if there is a way to do that using only windows (XP or 7) Answer Go to the directory and run the following command: for /f “Tokens=*” %f in (‘dir /l/b/a-d’) do (rename “%f” “%f”) Here is … Read more

How to force Windows to rename a file with a special character?

I have a song that Windows can’t play because there is a question mark in the name of the file. “Where Have All the Cowboys Gone?.ogg” // as an example So I try to rename it and Windows complains whether I try it in Explorer or from command prompt. Error I get when trying to … Read more

How does the Windows RENAME command interpret wildcards?

How does the Windows RENAME (REN) command interpret wildcards? The built in HELP facility is of no help – it doesn’t address wildcards at all. The Microsoft technet XP online help isn’t much better. Here is all it has to say regarding wildcards: “You can use wildcards (* and ?) in either file name parameter. … Read more