본문 바로가기

카테고리 없음

A Better Finder Rename 8: The Batch File Renamer For Mac

A Better Finder Rename is the most complete renaming solution available on the market today. That’s why, since 1996, thousands of hobbyists, professionals and businesses alike depend on A Better Finder Rename to organize and maintain files.

. One of OS X 10.10 Yosemite’s most useful new features — batch renaming in the Finder — has gone largely overlooked in the weeks since its release.

In the past, you had to use a third-party utility, Automator, or some kind of shell script to rename a set of files quickly. Batch renaming has a number of uses. For instance, if you’re trying to reduce paper in your office (as Joe Kissell suggests in “”), being able to rename several PDF documents — such as scanned electric bills — at once is essential. Similarly, automatically generated log files or still images from a webcam might also lend themselves to batch renaming. To get started, select the files you wish to rename in the Finder, using any of the standard methods. (Press Command-A if you want everything in the current folder; drag a selection box around them; select the first file in the series and then Shift-click the last file of the series; or press Command and individually select files.) Once you’ve selected the files, Control-click one of the selected files, and choose Rename # Items, where # is the number of files selected.

For

In the resulting dialog, a pop-up menu lets you choose which action to take: replacing text, adding text, or performing more complex formatting. Pay particular attention to the preview in the lower left of the dialog, which shows you what the renamed files will look like.

The options are:. Replace Text, which lets you find one string of text and replace it with another. In this screenshot I’m replacing the date with “Harris-Halloween”. Unfortunately, the Finder’s batch rename tool doesn’t understand wildcards or regular expressions, so there’s no easy way to get rid of the timestamp with Replace Text (but see below for an alternate approach). Format, which either adds to or replaces the name with a pattern. Format offers three different name formats that combine the files’ existing names with an index, counter, or date, each of which can appear before or after the name:. Name and Index inserts a number, starting with the number of your choice.

Name and Counter does the same, but in a five-digit format, like 00055. Name and Date adds the date in this format: YYYY-MM-DD at HH.MM.SS AM/PM You can also replace the existing filenames by using the Custom Format field. The photos in my example screenshots are already named by date and time, and in the example below I’m renaming the files to start with “Harris-Halloween-” plus an index number. This isn’t the sort of feature that most of us will need every day, but it’s important to remember that it exists for those times when you want to avoid the tedious task of renaming a slew of files according to a simple pattern. Of course, independent Mac developers have long offered utilities that provide even more capabilities.

From Many Tricks comes recommended by our own Jeff Carlson and Federico Viticci of MacStories, and others like are also excellent choices. And if you want to rename files automatically, try Noodlesoft’s, but take care when setting it up, since with great power comes great ease in messing things up. I recommend testing on a subset before letting Hazel loose on a large number of files.

For more on Hazel, see Joe Kissell’s “.”. I have also found A Better Finder Rename a valuable and very powerful tool for batch file renaming. For digital photos especially, it is handy to use it together with A Better Finder Attributes. The latter app allows correction to file information such as exif time stamps. That's useful, for example, when I forget to correctly reset the date/time on a camera. So it does for file attributes what A Better Finder Rename does for file/folder names.

Both apps are well maintained and updated by Frank Reiff. As mentioned earlier, with power comes the ability to create carnage. A Better Finder Rename is quite good at displaying what will happen, but I still proceed with caution.

. When I was preparing inline graphics—the little images embedded in a line of text—for my book, I was almost finished when I remembered that the filenames needed to adhere to a naming convention: they must end with inline. Nearly 50 files needed renaming.

A brief mental facepalm moment was followed by the relieved realization that the Finder could do it for me with its batch-rename capability. You didn’t know the Finder has a batch-rename capability?

That’s because the option is disguised as a seemingly useless Rename command in the File menu. After all, you can rename a file by clicking and typing. So, the Rename command has no reason to exist—until you’ve selected multiple items. Then, it changes to Rename X Items (identifying the number of selected items).

But how would you know that since you aren’t likely to peruse menus after you’ve selected a bunch of files or folders? And that’s how you start: select multiple items in any window view (including, if you need to, a mix of files and folders) and choose File Rename X Items. (For the rest of this article, I’ll refer to the command as simply Rename Items.) The Batch-Rename Triad When you choose Rename Items for a selection, a dialog appears. (If you’re working in a window, it slides out from the title bar; if you’ve selected items on the desktop, you get a free-floating version.) Its pop-up menu offers three options:. Replace Text: Change any part of the existing filename to some other text.

This option also lets you delete characters from filenames by replacing the existing text with nothing. Add Text: Add text before or after the filename. Format: Append an index or counter number (the latter uses leading zeros for a fixed number of digits) or the current date and time to the filename. You can place the number before or after the filename, replace the filename with different text, or obliterate the original name completely.

We’ll take a look at each of these options in action. Replace or Delete Filename Text How many files do you have whose names start with IMG?

Every time you dump images from your camera to your Mac, they’re named with that prefix, followed by a 4-digit number. Replace those leading characters with a descriptor so that you’ll know what’s what:. In the Finder window with the photo files, choose Edit Select All, and then File Rename Items. Choose Replace Text from the dialog’s pop-up menu. In the Find field, enter IMG.

For Replace With, enter a description: Pool Party, Graduation, Disney World, or whatever. Be sure to include a trailing space or some other separator after the text.

(Alternatively, set only IMG to be replaced, leaving the underscore.). If the example in the lower left of the dialog looks right, click Rename. Have you ever wound up with a bunch of montly reports scattered among your monthly ones, or some similarly repeated typo? To replace montly with monthly:.

A Better Finder Rename 8 The Batch File Renamer For Mac

Select the target files and choose File Rename Items. Choose Replace Text from the pop-up menu. In the Find field, type montly; in Replace With, type monthly. Or, use shorter text replacement, such as substituting tly for thly as long as it wouldn’t interfere with other text in the filenames. You might be tempted to use the even briefer change of ly to hly; with that approach, however, if some of the files were correctly named to begin with, they would wind up with an extra h—monthhly. I recommend using full words to avoid problems that you might not notice while they’re still easily undo-able—although I confess this is a case of “Do as I say, not as I do.” If it’s too late to undo the mistake, it’s usually a cinch to do a second, more careful, batch rename to correct the issue.

(Undo details are in the “Quick Tips” list at the end of this article.) You can also use the Replace Text option to delete text from a filename: simply enter the delete target in Find, and leave Replace With blank. So, if you’ve decided that Monthly Report for January and its subsequent files are a tad redundant, set Find to monthly—making sure to include the trailing space—and leave Replace With empty. There’s another example of deleting filename text ahead, under “Multiple-Pass Renaming.” Add Text to Filenames The Add text option in the Rename dialog lets you—you guessed it!—add text to the beginning or end of the filename: choose Add Text from the menu, type the additional text, and specify whether it goes before or after the name. This is what I used to append inline to my graphics, the issue I mentioned at the beginning of this article.

You might find that you need to add a project name to a group of files, or that you forgot to append your initials to revisions of shared documents. Here’s how to make a simple adjustment like this:.

Select the target files. Choose File Rename Items. In the dialog, choose Add Text from the pop-up menu, type the text, and choose Before Name or After Name from the second pop-up.

Click Rename. As you can see in the screenshot above, an “after name” addition ignores the file extension (.png) because it’s not considered part of the file’s name. I frequently use this method to add leading zeroes to the beginning of single-digit numbers so I can more easily scan the then-even text in a list of numbered filenames. With just the single-digit files selected, I set the Rename option to Add Text, type a zero in the text field, and choose Before Name from the second menu.

Format Filenames with Numbers or Dates The Format menu choice in the Rename dialog is not a shining example of nomenclature, for either its title or its contents. Your formatting options are:.

Name and Index: Adds consecutive numbers, starting at 1 or a number you specify. Name and Counter: Adds consecutive numbers, also starting at 1 or a specified number, but creates five-digit numbers by padding with leading zeroes where necessary: 00001 and 00237, for example. Name and Date: Adds the current date, as well as the time, down to the nearest second, in the format 2018-05-23 at 9.27.55 AM. With each of these options, you can keep or replace the original filename, using the awkwardly named Custom Format field. Oddly, it usually starts with File as the default suggestion (without even the courtesy of a leading space, as you can see in the dialog’s Example line in this picture).

To replace the current filenames with a common name—so, for instance, only an index or counter number differentiates them (Field Test 1, Field Test 2)—enter that name in the Custom Format field. If you want the original name left intact, the Custom Format field must be blank, as shown in this picture. It’s not immediately apparent how either of the numbering options is applied to selected files. Here’s the trick: when you’re working in a List view that has the names in the first column, as is nearly always the case, the numbers are applied, in order, to those names.

No surprise there, but the controlling factor is actually the window’s sort order—Dated Created, say, or Size—which, of course, affects the order of the names. So make sure to get your files in the right order before renaming them. Multiple-Pass Renaming Sometimes renaming requires more than one pass: altering the name, then adding a date, and finally deleting the timestamp that accompanies the date, for instance.

But edits are simple to set up and take only seconds to run, so multiple passes are not time-consuming procedures. Reword Filenames If your files are named Monthly Report for Month, and you’d prefer them to be Month Report, run them through the rename mill twice, first stripping Monthly Report for, and then adding Report to the end of the filenames:. Select the target files and choose File Rename Items.

Choose Replace Text from the pop-up menu and type Monthly Report for (including a trailing space) in the Find field. Leave Replace With blank, and click Rename.

The files are now named with only the month. With the files still selected, choose File Rename Items again. Choose Add Text from the pop-up menu and type Report in the text field; choose After Name from the second pop-up, and click Rename. Strip the Time from Date & Time I firmly believe that the application of a date stamp should be separate from a timestamp, but Apple failed to consult me on the matter. Luckily, it’s easy to strip out the time:.

Get the exact wording of the timestamp portion of the renamed files by copying it from one of the filenames: select one of the files, activate its name by clicking it or pressing Return, and drag across the timestamp portion, including the “at” but leaving the leading or trailing space. Select all the target files and choose File Rename Items.

Choose Replace Text from the pop-up menu. Paste the copied timestamp into the Find field, and leave the Replace With field blank. Click Rename. Quick Tips Here are a few more things you should know:. Quick access to the Rename command: Tired of heading way up to the File menu for the Rename Items command? I have three solutions for you. Control-click any one of the selected files for a contextual menu that includes the Rename command, use the Action menu (the gear icon) in the window’s toolbar, or the third gets its own tip, next.

Keyboard shortcut for the Rename command: If you use the Rename command frequently and are the type of person who prefers keyboard commands, then you’ll be disappointed when you realize that you can’t set up a keyboard shortcut for a command whose wording constantly changes ( Rename 4 Items, Rename 12 Items). Except that you can—in a roundabout sort of way: set up shortcuts for many different versions of the command and assign all of them the same shortcut.

I didn’t, until I decided to try it for this because I prefer keyboard shortcuts for almost everything.) The method is no different from setting up other keyboard shortcuts:. Go to System Preferences Keyboard Shortcuts and click App Shortcuts in the app list.

Click the + button beneath the shortcut list and choose Finder from the pop-up menu in the dialog box. (If Finder is not in the shortcut list already, this procedure adds it; if it’s already listed, you still need to select it as the target.). In the Menu Title field, type Rename 6 Items.

(You don’t have to use the ellipsis character—typed with Option-semicolon—you can simply type three periods.). Go to the Keyboard Shortcut field and press the key combination you want to use. Repeat this process for other numbers of files in the command name, using the same key combination.

I’ve found that System Preferences occasionally objects to the use of the same shortcut for multiple commands, but only mildly: sometimes not all the commands are listed correctly in its window, showing only an ellipsis in place of the command name. But the shortcut keys remain displayed, the command names return on a subsequent opening of System Preferences, and all the shortcuts work in the meantime, so it’s only a minor glitch. Case insensitivity: In the Rename dialog box, the text you enter that is going to be replaced or erased is case insensitive—that is, upper- and lowercase letters are considered the same. But any replacement text will be used exactly as you type it. Undo a rename mistake: Whether you inadvertently introduced a typo while renaming files, chose the wrong option (counters instead of serial numbers, say), or realized the renaming just isn’t what you want, you can use the Edit Undo command to reverse the changes. If you change your mind about that, there’s Edit Redo to the rescue.

You can even go through several undo levels: if you added a serial number to the beginning of the file, and then a corrected project name to the end, you can undo each in turn to get back to the original filenames. Even if you’ve closed the window and opened others, you can go back to the folder of renamed files and undo the changes. There are some restrictions, of course, such as not having done anything undoable someplace else in the Finder. You’re probably thinking of the “date/time stamp” that identifies the creation or modification date of a file/folder, which, of course, usually differ, if only by seconds. But the example I used was regarding the date/time stamp applied from the Rename dialog, which puts the same date/time in the name of all the selected files; it uses the current date/time, which is unrelated to the creation/modified date stored internally for the items. I was showing how you can delete the time portion (which is unlikely to be of use) of that stamp. And no, there’s no way to do any kind of wild-card search/replace with the quite basic Rename command.

(Would that there were!). You do need to activate it yourself, how to activate is in the help, but I copied it here for you In order for the “A Better Finder Rename 10” item to appear in the Finder context menu and in other appropriate contexts, you need to manually activate the service in the “Services Preferences”. Proceed as follows:. go to the Finder. open the “Finder” menu and navigate to “Services”, then to “Services Preferences”. in the “Services Preferences” application, tick the “A Better Finder Rename 10” checkbox (in the “General” section) to activate the service.

optionally use the application to define a hot key (such as Command-Shift-R) for the service The service should now appear in the Finder’s context menu. If it does not, or if the item does not appear in the list, there’s a few things to check:. the “A Better Finder Rename 10” application needs to be in the “Applications” folder. you may need to launch A Better Finder Rename by double clicking it once. you may need to click on the “Force Services Menu Update” button in the “Services Menu Item” tab of the A Better Finder Rename 10 Preferences to force an update of Mac OS X’s services database. you may need to log in and out (or restart) for the service to become available These things might be necessary as Mac OS X checks all applications in the “Applications” and in the “Utilities” folders at start up to find out which applications define system services.

A better finder rename 8 the batch file renamer for mac

I’m with Ken here, in that I have a HUGE number of old Appleworks files with no extension, and would like to add LibreOffice’s.odt extension. Trouble is, they are grouped with many other files of different creator types. Does anyone know of any similar software with batch-renaming capabilities, that will search for files by hidden creator type and then add a file extension, either one associated with the file creator, or a different user specified.xtn? Sadly, I have no Terminal abilities. I’ve got a few old ClarisCad files that I’d like to add.xtns to and then try to crack open. I don’t ask for much.:-)).

If you use the command line and vim, look for vimv. There are a few versions, but they’re all basically little shell scripts that generate a list of filenames, drop you into vim editing a buffer containing those filenames, and then rename the files with the new names when you exit. This gives you the full power of vim (and any other command line program being vim can run them on the contents of a buffer) to modify the names, which easily eclipses what you can do with ABFR. Of course you have to have a little familiarity with bash and the more the better with vim, but if you do, it’s a great way to batch rename files. Talk about hidden treasures. I thought I knew my way around the Finder, but this is a revelation. I wonder how long this feature has been available.

That said, I’ve been using Name Mangler for years. One advantage it has is that it shows the results of your changes before you make them so you can see if your doing it right.

If you pay attention it can save a lot of trouble undoing the wrong changes. Also, if you can handle the complexity, it enables you to do multiple operations in one pass. Because Name Mangler does the job for me I haven’t tried A Better Finder Rename.

If you try too many tools to do the same thing it can get confusing (as if renaming files isn’t complex enough, whatever tool you use). But I may try this Finder secret, if I can remember it’s there, the next time I have to rename files just to see how well it works. So thank you Sharon for bringing this to light. Vim is a program editor. It’s line oriented and not word oriented.

It’s a frustrating editor for most people. For example, there are two distinct modes. One allows you to edit and enter text and the other is a “command mode” that allows you to move the cursor and manipulate text. There’s no menu system.

However, once you learn the logic, it’s easy to make massive changes in a few keystrokes. Like most Unix systems, vim uses regular expressions. You can usually imagine a simple instruction such as change all.txt suffixes to.markdown. You can do that with regular expressions, but so much more.

Here’s a simple (untested) Unix script: find.name “.img.jpg” while read filename do echo “mv ”$filename ” ”$filename ” commandfile.sh done This creates a file of all the files found by the find command and puts them into a file called commandfile.sh. Each line is a mv command which allows you to move or rename a file. As of now, each line moves the file to its own name. Mv img0001.jpg img0001.jpg mv img0002.jpg img0002.jpg. Now, I can load this file into vim and with a few key strokes, change the names of the files that I’m renaming. For example, instead of starting with img, I want them to start with photo: mv img0001.jpg photo0001.jpg mv img0002.jpg photo0002.jpg. Now, I can run commandfile.sh as a file of commands: $ sh commandfile Because I am editing commandfile.sh, I can manipulate it more easily than a single batch run.

Maybe take out a line for that one file I don’t want to rename. Maybe change “img” to “picnicatthepark” for the first dozen, but “caveadventure” for the rest. I can also verify each instance to make sure my renaming will do what I want. I don’t know if you still have this issue, but this is super easily done in AppleScript with less than 10 lines; you can even set it up to easily batch change multiple creator codes to multiple corresponding extensions with very little effort. It can be made to detect and display all creator codes within a batch of files for easy assignments.

It could be made into a Droplet app (drag a group of files to an icon for processing); run as a freestanding script; made into a Service available from the Menubar or Right-Click in Finder; hot-keyed, etc. Somewhere I still have a droplet set that fixes extensions and creator codes for various file types, and is easily edited; or I could quickly write one for your needs and post here. HTH Frederico. This is what happens when you learn all your Finder keyboard equivalents in 2001 and never look at the menus again. That’s a great story, Sharon. I don’t think it’s been mentioned yet: probably the easiest way for people unused to Mac scripting is to use Automator, as there are drag-and-drop pieces you can use to make this script. And if you don’t feel comfortable creating Services and such, you can run it within the Automator window and save it like a regular document, then re-open it when you need it.

(For seldom-used scripts and Automator actions, this is usually preferable anyway.) If non-scripter want to delve into the command line or AppleScript for more powerful tools (command line has the advantage that there are more copy-and-paste examples generally available—with the disadvantage that some Linux one-liners don’t work on Mac), always make a backup of your target folders first, as these kinds of commands don’t have Undo and are a one-way trip.