folder

A Linux shell script to rename files with a counter and copy them

As a brief note today, I was recently looking for all Messages/iMessage files that are stored on my Mac, and I used this shell script to copy all of those files — many of which have the same name — into a directory named tmpdir, giving them all new names during the copy process:

count=1
for i in `cat myfiles`
do
    fname=`basename $i`
    cp $i tmpdir/${count}-${fname}
    count=`expr $count + 1`
done

What is the Mac OS X (macOS) fonts folder? (to add new fonts)

Apple/Mac FAQ: I want to add new fonts to my Mac, what is the Mac OS X (macOS) fonts folder?

Just put any new font files in the Library/Fonts folder under your home directory. For instance, my Mac OS X username is alvin, so the correct fonts folder is:

A Scala function to list subdirectories in a directory

If you ever need to generate a list of subdirectories in a directory in Scala, here's one way to do it:

def getListOfSubDirectories(directoryName: String): Array[String] = {
  return (new File(directoryName)).listFiles.filter(_.isDirectory).map(_.getName)
}

I intentionally wrote that function in a short, "Scala like" style, but you can expand it to multiple lines, if you prefer.

Mac Finder font size (folder font size)

Mac Finder font size FAQ: How do I adjust the Mac Finder font size (also known as the Mac Finder folder font size)?

You can adjust the Mac Finder font size by right-clicking on an open area of a Mac Finder folder, then selecting the Show View Options menu item. From the dialog that is displayed you can adjust the Finder folder grid size, font size, and a couple of other things there, including:

Mac Desktop font size (and icon size)

Mac Desktop font size FAQ: How do I adjust the Mac Desktop font size? (Related: How do I adjust the Mac Desktop icon size?)

You can adjust the Mac Desktop font size (and Mac Desktop icon size) by right-clicking on an open area of your Mac Desktop, then selecting Show View Options.

From that dialog you can adjust the Desktop icon size, Desktop font size, and a couple of other things there:

Mac Finder 'new folder' keystroke bug

While replying to a comment on an earlier Mac Finder new folder keystroke article, I found a bug in the Mac OS X Finder that I thought I'd mention here as well to make it easier for people to find. In short, the keystroke you can normally use to create a new Finder folder is:

[Shift] [Command] n

Mac Dock folder tip - How to move a folder to the Mac Dock

Mac Dock FAQ: How do I move a commonly used Mac folder to the Dock so I can access it easier?

When you first buy a Mac, the right side of the Dock (the right side of the highway stripe on the Mac Dock) will have just the basic items on it, such as the Applications and Downloads folders. What a lot of people don't know is that you can put links (shortcuts) to your own folders there as well. In fact, this is a great place to put shortcuts to your most commonly used Mac folders.

The Mac Finder new folder keystroke command

Mac OS X Finder FAQ: How do I create a new Mac Finder folder using the keyboard? (Or, What is the Mac Finder new folder keystroke or keyboard command?)

To create a new folder in the Mac Finder using the keyboard:

MacOS Finder: How to delete files using keyboard keys

Mac OS X Finder FAQ: How can I delete a file or directory in the Mac Finder using the keyboard (keystroke)?

By now you've probably figured out that you can't just delete a file in the Mac Finder using the delete key. The solution:

Mac folder size - how big is this folder?

Mac OS X Folder FAQ: How do I determine the size of a Mac folder?

Answer: I started to write about how you could use the Unix "du" (disk usage) command on a Mac OS X system to determine the Mac folder size, but then I realized there's a little more obvious approach: Use the "info" command when you have a folder selected in the Mac Finder.

Mac folder size

Using your Mac "Desktop" folder as an example, here's how it works: