Rename dir mac os

Change the name of your macOS user account and home folder

You can rename your macOS user account and home folder, which were named when the account was created.

The name of your macOS user account and the name of your home folder must both be the same. Changing these names does not change or reset the password of your user account.

Because doing this incorrectly could damage your account and prevent you from logging in, you should back up your important data before proceeding.

First rename the home folder

  1. Log out of the account you’re renaming, then log in to a different administrator account. (If you don’t have another administrator account, you can create one in Users & Groups preferences.)
  2. Open the Users folder on the startup disk. It contains the home folder for each user. To get there, you can choose Go > Go to Folder from the menu bar, then enter /Users .
  3. Rename the user’s home folder without using any spaces in the new name. You’ll be prompted to enter the administrator name and password that you used to log in. If you’re using file sharing to share the home folder, you won’t be able to rename it until you stop sharing the folder.

Then rename the account

While still logged out of the account you’re renaming, follow these additional steps:

  1. Choose Apple () menu > System Preferences, then click Users & Groups.
  2. Click , then enter the administrator name and password that you used to log in.
  3. From the list of users on the left, Control-click the user you’re renaming, then choose Advanced Options.
  4. Change the “Account name” field to match the new name of the home folder. It should have no spaces.
  5. The account name also appears in the “Home directory” field, after /Users/ . Change that account name to match the new name of the home folder.
  6. If you want to change the full name associated with your account, update the ”Full name” field as well. It can be any name, and you can use either the full name or the account name to log in to your Mac or make changes that require your name and password.
  7. Click OK, then restart your Mac.
  8. Log in to the renamed account, then verify that your old files and folders are visible and the account is working as expected.

Источник

Question: Q: Unix «rename» Terminal command available in OS X?

I have a couple of different cameras/phones that deliver their photos as

DSC00001.jpg
DSC00002.jpg
DSC00003.jpg
etc.

I want to be able to rename these files such that «DSC» is replaced by the camera or phone that took the shot. The «rename» command in Unix (and CMD prompt in XP) do exactly what I need. I just run

rename DSC*.jpg W580i*.jpg and all of file in the folder are renamed.

When I try and run the rename command in a Terminal in OS X, I get this error

mr-mbp:Pix_Xfer MR$ rename
-bash: rename: command not found

Is there a way to enable the rename command in OS X?

I found a nice script called «Replace Text in Item Names» that does what is needed however the command seems so much easier.

MBP 2.6, Mac OS X (10.5.5)

Posted on Oct 20, 2008 4:43 PM

All replies

Loading page content

Page content loaded

Oct 20, 2008 4:56 PM

rename is not a standard Unix command.

You could go over to and search for rename. You will find Mac OS X utilities such as *A Better Finder Rename*, FileRenamer, Renamer4Mac, AispireRenamer, *File Renamer*, etc.

If you really want to do this with the terminal, you could try

If you install Fink , there is gwenrename, krename, and ren that can be installed. Not sure how they work, but they might be options.

Oct 20, 2008 5:41 PM

BobHarris wrote:
rename is not a standard Unix command.

It’s included as an alias in some Unix systems for PC users.
Actually in Leopard you can
man rename
and get a result
but, the command is not in the system (too many letters to type when mv will do 🙂 )

Читайте также:  Восстановление системы не было успешно завершено windows 10 0х80070005

Oct 20, 2008 5:43 PM

Actually in Leopard you can
man rename
and get a result
but, the command is not in the system (too many letters to type when mv will do 🙂 )

Oct 21, 2008 7:58 AM

Actually in Leopard you can
man rename
and get a result
but, the command is not in the system (too many letters to type when mv will do 🙂 )

*man rename* brings up a *Section 2* C programming API.

That’s absolutely correct
As I wrote:
man rename
produces a result

Oct 21, 2008 8:47 AM

If you really wanted Unix rename it’s quite easy:

1. Go here and d/l ftp://ftp.kernel.org/pub/linux/utils/util-linux-ng/v2.14/
2. Look for rename* in misc-utils after untar
3. Remove the preprocessor in rename.c for PACKAGE_STRING and the corresponding (%s)
4. compile it with gcc you get a.out, rename it to rename

You got yourself a unix rename

Jan 8, 2009 7:41 AM

It’s been awhile since I’ve dealt with C and gcc, so I’m getting lost in step 3 of your instructions. Could I trouble you to be a bit more explicit? Unix rename is our friend and I very much miss it.

Mar 12, 2009 8:38 PM

Mar 12, 2009 8:55 PM

The easy solution to this is as «VK» and «nerowolfe» suggest. use «mv».

The «mv» command IS the standard unix «rename» command. Just reference the same location (filepath) with a new filename and you will have a rename. For example:

File location:
/Users/username/textfile.txt

To rename this to «textfile2.txt» you would type:

mv /Users/username/textfile.txt /Users/username/textfile2.txt

Alternately, if you are in the «username» folder, or in any folder containing the file to be renamed, you do not need to reference the full path. as such:

mv textfile.txt textfile2.txt

Some paranoid people may wish to create a hard link of the file before renaming it, and then deleting the old file, since this will create a copy without removing a reference to the file for the brief microsecond that it takes to «move» the file using the «mv» command.

Mar 12, 2009 9:39 PM

If I were renaming a single file mv would be perfect, but I need to do many files at once. The practicum is that I have a set of files that have an underscore in the file name. I wrote a perl script that automatically generates LaTeX code to make a book for the pictures. However, the \includegraphics command in LaTeX does not care for underscores in filenames so I want to transliterate the underscores into something more LaTeX friendly, like dashes. With rename it’s as simple as this:

and all of my images that had underscores in their names are replaced with dashes. mv just isn’t practical when I’m looking at hundreds (or more) of images. That’s why I was so interested in the build of rename from linux — I don’t care what the source is, I just need the functionality.

Now, the rename.c file does have a shell script at the top that is a very decent substitute:

#!/bin/sh
if [ $# -le 2 ]; then
echo call: rename from to files; exit;
fi
FROM=»$1″
TO=»$2″
shift
shift
for i in $@; do N=`echo «$i» | sed «s/$FROM/$TO/g»`; mv «$i» «$N»; done

but the compiled C program does fix some potential issues, and it would also satisfy the purist in me that loves having a native compiled rendition of rename around.

Mar 12, 2009 10:20 PM

I should preempt advice about performing the file renaming in perl. Certainly that is an option but I prefer separation of duties. My perl script is for generating LaTeX and I don’t want it to tread into the realm of file management. There are also many uses for the rename utility — stripping version numbers from VMS files sprngs to mind. I am working under the assumption that the contributors to rename.c understand file management and renaming issues much more than I do — elsewise I’d stick with a perl or bash script.

Mar 12, 2009 11:25 PM

I was working on some file operations today and I remembered that I actually once wrote a rename utility in perl for working on Windows. I brushed it off and took out all of the Windows wackiness (the command line doesn’t expand blobs, etc.) and have another working solution. I’m not savvy enough to tell if it’s better than the shell script from rename.c or not, but it works for what I need it for.

Читайте также:  Booting windows in test mode

#!/usr/bin/perl -w
#
# Simulate the ‘rename’ file utility
#

my $usage = «usage: $0 FROM_SPEC TO_SPEC filespec1 filespec2 filespec3\n»;
$usage .= «Example: $0 _ — *.txt *.log this_file.c\n\n»;

my $specFrom = shift || die «[Missing FROM_SPEC.]\n\n$usage»;
my $specTo = shift || die «[Missing TO_SPEC.]\n\n$usage»;
if ($#ARGV = 0) <
my $fileSource = shift;
my $fileTarget = $fileSource;
$fileTarget =

s/$specFrom/$specTo/g;
next if («$fileSource» eq «$fileTarget»);
print «\t[Processing $fileSource => $fileTarget]\n»;
if ( -e $fileTarget ) <
print «\t\t[$fileTarget aleady exists. Skipping.]\n»;
>
else <
rename $fileSource, $fileTarget;
>
>

Источник

Rename files, folders and disks on Mac

You can change the name of most files, folders and disks, including the internal hard disk (named Macintosh HD by default). If you change the name of your hard disk, it still appears with its original name on a network.

Rename one item

On your Mac, select the item, then press Return. Or force click the item’s name.

Enter a new name.

You can use numbers and most symbols. You can’t include a colon (:) or start the name with a full stop (.). Some apps may not allow you to use a slash (/) in a filename.

Rename multiple items

On your Mac, select the items, then Control-click one of them.

In the shortcut menu, choose Rename.

In the pop-up menu below Rename Finder Items, choose to replace text in the names, add text to the names or change the name format.

Replace text: Enter the text you want to remove in the Find field, then enter the text you want to add in the “Replace with” field.

Add text: Enter the text you want to add in the field, then choose to add the text before or after the current name.

Format: Choose a name format for the files, then choose to put the index, counter or date before or after the name. Enter a name in the Custom Format field, then enter the number you want to start with.

These are some items you should not rename:

App folders and any items that came with your system, such as the Library folder. (If you change the name of an item and experience problems, change the name back. If this doesn’t help, you may need to reinstall the software.)

Filename extensions — the full stop followed by a few letters or words that you see at the end of some filenames (for example, .jpg). If you change an extension, you may no longer be able to open the file with the app that was used to create it.

Your home folder — the one with your name on it.

Источник

Rename files and folders on Mac using Terminal

By Chaitanya | Filed Under: Mac

In my previous guide, I have shared four methods of renaming a file or a folder, in that guide I have discussed a little bit about renaming via command line. In this guide, we will discuss it in detail. The command we will use for this is: mv. The mv command not only renames your file/folder, it can change the location of your renamed file if you wish to do so.

Let’s get familiar with the syntax of mv command first:
If the file or folder you want to rename is in the current working directory(to check your current working directory just type pwd on terminal and hit return):

If the file or folder you wish to rename is not in the current working directory then you need to provide the full file name.

Renaming a file via command line

Steps are as follows:

1. Type mv then open Finder and drag the file on terminal (this is to copy the full path of file to the terminal)
Note: Please do note that while dragging the file to terminal, make sure that the finder window and terminal window don’t overlap else this trick won’t work.

2. Now you need to give the new file name, here you have two options based on where you want your new file to be. If you want your new file at the same location then type the same full path (or you can drag the file again and just edit the file name) with the new file name. The full command will look like this:

Читайте также:  Для чего папка windows mail

If you want your renamed file at different location then instead of copying the same full path again just type the new file path with file name. This operation will change the file name as well as change the location of your file.
For example:

Now the renamed file would be moved from TheMacBeginner folder to the Documents folder.

Источник

How to Batch Rename Files on Mac OS X Easily from Finder

Modern versions of Mac OS X include a built-in batch file renaming tool that allows Mac users to instantly rename large groups of files, folders, photos, or anything else residing on their file system in a single action. This bulk rename item utility is part of the Finder, meaning there are no add-ons, downloads, or DIY Automator tools to use, and the rename function is very powerful, yet extremely simple to use.

We’re going to demonstrate how to rename a group of files on a Mac by matching a string of text and replacing it with another string of text. You’ll find the basic rename tool works quite similar to other Find & Replace functions found throughout other applications, except that it’s limited to the file or folder names of items you choose in the Mac OS Finder. You’ll also find abilities to append text to file names, or to completely format existing file names and replace them with new text.

How to Batch Rename Files on Mac with the Rename Finder Item Function of Mac OS X

  1. Select the files in the Finder of Mac OS that you wish to batch rename
  2. Right-click (or Control+Click) on the selected files and choose “Rename X Items” where X is the number of files selected

  • In the “Rename Finder Items” tool that appears, choose ‘Replace Text’ from the dropdown (this is the default)
  • Modify the “Find” search to match the string you wish to replace, then modify the “Replace With” box to match what you want the files to be renamed to, the “Example:” shown at the bottom of the Rename Finder Item window will show what the files renamed will look like

  • Click on “Rename” to instantly rename all the files that were selected
  • The renaming process happens almost instantly, though if you’re renaming hundreds or thousands of selected files it will take a moment or two to complete the renaming procedure, as it occurs on a file by file basis. When it’s finished, you can immediately see the results in the Finder, the file names will be changed to what you chose in the rename utility.

    The Rename Finder Items tool has three renaming options, the aforementioned find and replace text match, the ability to add text to file names, and finally, the ability to completely rename and change the file name format to anything sequential. These options are selected through the dropdown menu of the rename tool panel, all are equally simple to use.

    The brief video below demonstrates the bulk rename of files by replacing existing text with new text, using this renaming tool in the Finder of Mac OS X:

    Batch renaming is undeniably useful, whether used to make many files have more descriptive file names, or even to reduce long file names to shorter ones. There are a myriad of purposes for bulk renaming functions, and for those who make heavy usage of the file system, you’ll likely find yourself using this feature very often.

    The Rename Finder Items function requires that the Mac be running MacOS / Mac OS X 10.10 or later to have this feature available, earlier versions of Mac OS X can batch rename files by using this Automator tool instead. That Automator script continues to work in modern versions of OS X as well, it’s just less necessary now that the Mac includes a native utility to perform bulk renaming functions.

    Oh and by the way, if you select a single item in the Finder and use a right-click, you’ll find the “Rename” function is missing from the contextual menu. That’s because renaming a single file or folder is done through the item name itself, either by clicking into the file name or by hitting the Return key as the file or folder is selected.

    Источник

    Оцените статью