Results 1 to 2 of 2
I have a directory of folders whose names follow the pattern of "DATE - NAME [" like so:
Code:
1978 - Demos (tape) [
1980 - Fresh Fruit For Rotting ...
- 11-28-2010 #1Just Joined!
- Join Date
- Nov 2010
- Posts
- 22
mmv file rename syntax
I have a directory of folders whose names follow the pattern of "DATE - NAME [" like so:
I have already used mmv to remove most of the unwanted file name but I got stuck with the [. I want the output to be "NAME (DATE)" but when I run thisCode:1978 - Demos (tape) [ 1980 - Fresh Fruit For Rotting Vegetables [ 1981 - In God We Trust, Inc [
The output is:Code:mmv "* - * [" "#2 (#1)"
I think mmv recognizes the bracket as a special character and not treating it as a regular character which it will delete. I think I have to change the quotation marks or something along those lines, but how/what do I change? It follows the same rules as bash scripting as far as I know.Code:* - * [ -> #2 (#1) : missing ]. Nothing done.
- 11-29-2010 #2Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 8,970
Try the "rename" command. It has more flexibility to do what you seem to want. The rename command manpage:
Code:RENAME(1) Linux Programmer’s Manual RENAME(1) NAME rename - Rename files SYNOPSIS rename from to file... DESCRIPTION rename will rename the specified files by replacing the first occurrence of from in their name by to. For example, given the files foo1, ..., foo9, foo10, ..., foo278, the commands rename foo foo0 foo? rename foo foo0 foo?? will turn them into foo001, ..., foo009, foo010, ..., foo278. And rename .htm .html *.htm will fix the extension of your html files. SEE ALSO mmv(1), mv(1) 1 January 2000 RENAME(1)Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!


Reply With Quote