Unix help

halitri

Registered
I was following instructions found at:

http://ad.hominem.org/log/2005/07/acl.php

to set up my iPhoto library to be shared. In the Unix shell I navigated to my Pictures directory at which point the only thing in that directory was the "iPhoto Library" directory.

I issued the command:

mv iPhoto\ Library ../../Shared/Pictures

The command executed but instead of putting the directory in /Users/Shared/Pictures, it appears to have moved the contents of the directory. When I now look in /Users/Shared/Pictures I would expect to see "iPhoto Library" but instead I see a bunch of files and directories that look a lot like what was in the iPhoto Library before I moved it. I haven't verified that they are exactly the same but I can do that by looking in another user's directry and seeing what is in that directory to begin with.

My questions now are:

1. Why did it do what it did, instead of moving the directory?
2. What do I do now? Obviously I can't create a link since the iPhoto Library directory does not exist under /Users/Shared/Pictures. Should I create a directory named iPhoto Library in /Users/Shared/Pictures and then move all contents into it? If so, will I need to change permission after I create the directory?
 
The "mv" command tends to be a bit tricky. You have to supply the name of the source directory in the destination path, otherwise it dumps all of the contents of the source directory into the last directory in the destination path given.

Also, the directions didn't mention to use the "mv" command. I'm guessing it was assumed that you would move it with the mouse.

Now, why didn't you just use the Mac OS X Finder to move the directory over to your designated destination? That would have been much easier. You have the GUI....use it. :)
 
"mv iPhoto\ Library ../../Shared/Pictures"

your error is the format of your command. Your interpretation is that iphoto library is to move to Pictures, but the mv command sees it as move iphoto library to become Pictures. Adding another slash at the end of Pictures would tell mv to move the library within the Pictures directory

mv iPhoto\ Library ../../Shared/Pictures/

I haven't read the requirements. What link do you require? I assume it is a link back to where the original iphoto library was? If that is correct, then yes you still can make the link. They don't have to be the same name. You can link the pictures directory to the orginal iphoto library location
 
Thanks,

If you see my post in the "Switchers" forum you'll see why I didn't move it with the mouse. I'm a new Mac user and couldn't figure out how to view /Users/Shared in the Finder.

Anyhow, it appears to have moved the contents of the directory, correct? What should I do now? Should I just create directory named "iPhoto Library" in /Users/Shared/Pictures and then copy the contents that should have been moved there into it? If I do that, will all the perms on the directory I create be correct as if iPhoto had created it?

I'm also wondering is there are other items in that directory that were not a result of this operation. In other words, if I create the iPhoto Library directory manually, are there some files in /Users/Shared/Pictures that should stay there and not be moved into the directory I create?
 
bluedevils,

If that is the case, would I have wiped out the original Pictures directory. It seems as though you are saying that iPhoto Library directory was moved and renamed to Pictures, even though a directory name Pictures already existed.

This has me confused because my SunOS box at work does not function this way. For example, see the following:

u001/app/cbh:mkdir x
u001/app/cbh:mkdir x1
u001/app/cbh:cd x1
u001/app/cbh/x1:mkdir x2
u001/app/cbh/x1:cd x2
u001/app/cbh/x1/x2:touch x2.1
u001/app/cbh/x1/x2:ls
x2.1
u001/app/cbh/x1/x2:cd ..
u001/app/cbh/x1:ls
x2
u001/app/cbh/x1:mv x2 ../x
u001/app/cbh/x1:cd
u001/app/cbh:ls
x x1
u001/app/cbh:cd x
u001/app/cbh/x:ls
x2
u001/app/cbh/x:cd x2
u001/app/cbh/x/x2:ls
x2.1
u001/app/cbh/x/x2:

I created directories x and x1 in my home directory. Inside x1 I created x2 and put a file in it. Then while in the x1 directory I moved the x2 directory with the "mv x2 ../x" command and it moved the directory, not just the contents. This is different than what MacOSX did. Why?
 
bluedevils,

If that is the case, would I have wiped out the original Pictures directory. It seems as though you are saying that iPhoto Library directory was moved and renamed to Pictures, even though a directory name Pictures already existed.

This has me confused because my SunOS box at work does not function this way. For example, see the following:

u001/app/cbh:mkdir x
u001/app/cbh:mkdir x1
u001/app/cbh:cd x1
u001/app/cbh/x1:mkdir x2
u001/app/cbh/x1:cd x2
u001/app/cbh/x1/x2:touch x2.1
u001/app/cbh/x1/x2:ls
x2.1
u001/app/cbh/x1/x2:cd ..
u001/app/cbh/x1:ls
x2
u001/app/cbh/x1:mv x2 ../x
u001/app/cbh/x1:cd
u001/app/cbh:ls
x x1
u001/app/cbh:cd x
u001/app/cbh/x:ls
x2
u001/app/cbh/x:cd x2
u001/app/cbh/x/x2:ls
x2.1
u001/app/cbh/x/x2:

I created directories x and x1 in my home directory. Inside x1 I created x2 and put a file in it. Then while in the x1 directory I moved the x2 directory with the "mv x2 ../x" command and it moved the directory, not just the contents. This is different than what MacOSX did. Why?
 
ya, solaris and bsd might not be the same.

osxfaq

mv [-fi] source target
[-fi] source ... directory


DESCRIPTION
In its first form, the mv utility renames the file named by the source
operand to the destination path named by the target operand. This form
is assumed when the last operand does not name an already existing direc-
tory.

In its second form, mv moves each file named by a source operand to a
destination file in the existing directory named by the directory
operand. The destination path for each operand is the pathname produced
by the concatenation of the last operand, a slash, and the final pathname
component of the named file.

The following options are available:

-f Do not prompt for confirmation before overwriting the destination
path.

-i Causes mv to write a prompt to standard error before moving a file
that would overwrite an existing file. If the response from the
standard input begins with the character ``y'', the move is at-
tempted.
The last of any -f or -i options is the one which affects mv's behavior.

It is an error for either the source operand or the destination path to
specify a directory unless both do.

If the destination path does not have a mode which permits writing, mv
prompts the user for confirmation as specified for the -i option.

As the rename(2) call does not work across file systems, mv uses cp(1)
and rm(1) to accomplish the move. The effect is equivalent to:

rm -f destination_path && \
cp -PRp source_file destination && \
rm -rf source_file

The mv utility exits 0 on success, and >0 if an error occurs.


SEE ALSO
cp(1), symlink(7)


STANDARDS
The mv utility is expected to be IEEE Std1003.2 (``POSIX'') compatible.

BSD Experimental May 31, 1993
 
Back
Top