Trying to move Documents Folder via Symbolic Link Problem - MacRumors Forums
Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > OS X

Reply
 
Thread Tools Search this Thread Display Modes
Old Sep 16, 2010, 06:45 PM   #1
sng08
macrumors member
 
Join Date: Aug 2010
Trying to move Documents Folder via Symbolic Link Problem

Hi all,

I've just recently received my new iMac 27" i7 and have the SSD + HDD option, where the SSD contains OS + Applications and the HDD contains data. I read that moving the whole Home folder was not a good idea, therefore, I wanted to just move my Documents, Pictures and Download folder to the second internal HDD. I read an article/tutorial how to do this and this is what I followed (using Terminals):

Code:
cp -Rp ~/Documents /Volumes/Macintosh Data HD
chmod -R -N ~/Documents
rm -rf ~/Documents
ln -s /Volumes/Macintosh Data HD/Documents ~/Documents
However, when I try and type the symbolic link I get the error:
Code:
"ln: Documents: No such file or directory"
Because of this, the Documents folder on the Dock appears with a big question mark as it cannot locate the new Documents folder.

Any ideas how I can get the link working or if not try and restore the original documents folder and just move the entire Home folder over to the Hard Disk data drive?

Many thanks in advance!

(note: I don't have any documents in the folders as of yet so I haven't lost any important info!)
sng08 is offline   0 Reply With Quote
Old Sep 16, 2010, 07:06 PM   #2
LPZ
macrumors 65816
 
Join Date: Jul 2006
Quote:
Originally Posted by sng08 View Post
Hi all,

I've just recently received my new iMac 27" i7 and have the SSD + HDD option, where the SSD contains OS + Applications and the HDD contains data. I read that moving the whole Home folder was not a good idea, therefore, I wanted to just move my Documents, Pictures and Download folder to the second internal HDD. I read an article/tutorial how to do this and this is what I followed (using Terminals):

Code:
cp -Rp ~/Documents /Volumes/Macintosh Data HD
chmod -R -N ~/Documents
rm -rf ~/Documents
ln -s /Volumes/Macintosh Data HD/Documents ~/Documents
However, when I try and type the symbolic link I get the error:
Code:
"ln: Documents: No such file or directory"
Because of this, the Documents folder on the Dock appears with a big question mark as it cannot locate the new Documents folder.

Any ideas how I can get the link working or if not try and restore the original documents folder and just move the entire Home folder over to the Hard Disk data drive?

Many thanks in advance!

(note: I don't have any documents in the folders as of yet so I haven't lost any important info!)
Those spaces in "Macintosh Data HD" seem like a very bad idea. In Terminal, enter

Code:
cd /Volumes; ls -la
(lowercase L after the ; and after the hyphen)

Post the output.

Last edited by LPZ; Sep 16, 2010 at 07:14 PM.
LPZ is offline   0 Reply With Quote
Old Sep 16, 2010, 07:27 PM   #3
sng08
Thread Starter
macrumors member
 
Join Date: Aug 2010
Quote:
Originally Posted by LPZ View Post
Those spaces in "Macintosh Data HD" seem like a very bad idea. In Terminal, enter

Code:
cd /Volumes; ls -la
(lowercase L after the ; and after the hyphen)

Post the output.
Hi, thanks for the quick reply. Below is the output:

Code:
cd /Volumes; ls -la

total 8
drwxrwxrwt@  6 root     admin   204 17 Sep 01:23 .
drwxrwxr-t  30 root     admin  1088 15 Sep 16:54 ..
drwxr-xr-x   1 SimonNg  staff  4096 16 Sep 12:21 BOOTCAMP
drwxrwxr-x   9 SimonNg  staff   374 17 Sep 00:26 Macintosh Data HD
lrwxr-xr-x   1 root     admin     1 17 Sep 01:23 Macintosh HD -> /
drwxr-xr-x   1 SimonNg  staff  4096 16 Sep 14:45 Windows Data HD
sng08 is offline   0 Reply With Quote
Old Sep 16, 2010, 07:33 PM   #4
LPZ
macrumors 65816
 
Join Date: Jul 2006
In Terminal,

Code:
cd /Volumes/Macintosh*Data*HD; ls -la
LPZ is offline   0 Reply With Quote
Old Sep 16, 2010, 07:52 PM   #5
sng08
Thread Starter
macrumors member
 
Join Date: Aug 2010
Quote:
Originally Posted by LPZ View Post
In Terminal,

Code:
cd /Volumes/Macintosh*Data*HD; ls -la
Result:

Code:
cd /Volumes/Macintosh*Data*HD; ls -la
total 16
drwxrwxr-x  9 SimonNg  staff   374 17 Sep 00:26 .
drwxrwxrwt@ 6 root     admin   204 17 Sep 01:23 ..
-rw-r--r--@ 1 SimonNg  staff  6148 17 Sep 00:46 .DS_Store
drwx------  3 root     staff   102 16 Sep 12:35 .Spotlight-V100
d-wx-wx-wt  3 root     staff   102 17 Sep 01:24 .Trashes
drwx------  5 root     staff   170 17 Sep 01:17 .fseventsd
drwxr-xr-x@ 3 SimonNg  staff   102 17 Sep 00:31 Documents
drwxr-xr-x@ 3 SimonNg  staff   102 16 Sep 22:38 Downloads
drwxr-xr-x@ 3 SimonNg  staff   102 16 Sep 22:41 Pictures
sng08 is offline   0 Reply With Quote
Old Sep 16, 2010, 08:02 PM   #6
LPZ
macrumors 65816
 
Join Date: Jul 2006
OK, there's a directory named Documents where you copied it to.

In Terminal, enter

Code:
cd ~; ls -la
LPZ is offline   0 Reply With Quote
Old Sep 17, 2010, 04:32 AM   #7
sng08
Thread Starter
macrumors member
 
Join Date: Aug 2010
Quote:
Originally Posted by LPZ View Post
OK, there's a directory named Documents where you copied it to.

In Terminal, enter

Code:
cd ~; ls -la
Result:

Code:
cd ~; ls -la
total 24
drwxr-xr-x+ 14 SimonNg  staff   476 17 Sep 01:24 .
drwxr-xr-x   5 root     admin   170 15 Sep 15:29 ..
-rw-------   1 SimonNg  staff     3 15 Sep 15:29 .CFUserTextEncoding
-rw-r--r--@  1 SimonNg  staff  6148 17 Sep 00:32 .DS_Store
drwx------   2 SimonNg  staff    68 17 Sep 01:24 .Trash
-rw-------   1 SimonNg  staff  2140 17 Sep 01:55 .bash_history
drwx------+  3 SimonNg  staff   102 15 Sep 15:29 Desktop
drwx------+  5 SimonNg  staff   170 16 Sep 22:17 Downloads
drwx------+ 30 SimonNg  staff  1020 15 Sep 17:15 Library
drwx------+  3 SimonNg  staff   102 15 Sep 15:29 Movies
drwx------+  4 SimonNg  staff   136 16 Sep 20:59 Music
drwx------@  6 SimonNg  staff   204 16 Sep 22:41 Pictures
drwxr-xr-x+  5 SimonNg  staff   170 15 Sep 15:29 Public
drwxr-xr-x+  5 SimonNg  staff   170 15 Sep 15:29 Sites
sng08 is offline   0 Reply With Quote
Old Sep 17, 2010, 04:47 AM   #8
Angelo95210
macrumors 6502a
 
Angelo95210's Avatar
 
Join Date: Jan 2009
Location: Paris, France
I just moved my entire home folder and I find it to be the perfect solution. There is no worries with this, it's even a recommended practice for linux users. Only precaution is to let one user on the main partition in case of failure.
__________________
Hackintosh G31M-S2L - Macbook 3,1
Angelo95210 is offline   0 Reply With Quote
Old Sep 17, 2010, 04:57 AM   #9
LPZ
macrumors 65816
 
Join Date: Jul 2006
Quote:
Originally Posted by sng08 View Post
Result:

Code:
cd ~; ls -la
total 24
drwxr-xr-x+ 14 SimonNg  staff   476 17 Sep 01:24 .
drwxr-xr-x   5 root     admin   170 15 Sep 15:29 ..
-rw-------   1 SimonNg  staff     3 15 Sep 15:29 .CFUserTextEncoding
-rw-r--r--@  1 SimonNg  staff  6148 17 Sep 00:32 .DS_Store
drwx------   2 SimonNg  staff    68 17 Sep 01:24 .Trash
-rw-------   1 SimonNg  staff  2140 17 Sep 01:55 .bash_history
drwx------+  3 SimonNg  staff   102 15 Sep 15:29 Desktop
drwx------+  5 SimonNg  staff   170 16 Sep 22:17 Downloads
drwx------+ 30 SimonNg  staff  1020 15 Sep 17:15 Library
drwx------+  3 SimonNg  staff   102 15 Sep 15:29 Movies
drwx------+  4 SimonNg  staff   136 16 Sep 20:59 Music
drwx------@  6 SimonNg  staff   204 16 Sep 22:41 Pictures
drwxr-xr-x+  5 SimonNg  staff   170 15 Sep 15:29 Public
drwxr-xr-x+  5 SimonNg  staff   170 15 Sep 15:29 Sites
OK, the original Documents folder is indeed removed and the name is available. In Terminal, let's try again:

Code:
ln -s /Volumes/Macintosh*Data*HD/Documents  ~/Documents
LPZ is offline   0 Reply With Quote
Old Sep 17, 2010, 06:35 AM   #10
sng08
Thread Starter
macrumors member
 
Join Date: Aug 2010
Quote:
Originally Posted by LPZ View Post
OK, the original Documents folder is indeed removed and the name is available. In Terminal, let's try again:

Code:
ln -s /Volumes/Macintosh*Data*HD/Documents  ~/Documents
Hi LPZ. I think it worked! The big black question mark on the documents folder has disappeared and it links to the second HD. Excellent. Thank you so much for your help!

So to move the folder, the symbolic link requires the * to denote a space?
Also, is it worth moving that folder back to the home and just move the entire HOME folder over or just individually move folders that I require over to the second internal hard drive?
sng08 is offline   0 Reply With Quote
Old Sep 17, 2010, 06:36 AM   #11
sng08
Thread Starter
macrumors member
 
Join Date: Aug 2010
Sorry to be a pain, but to clarify the terminal code for moving the folder should be:

Code:
cp -Rp ~/Documents /Volumes/Macintosh*Data*HD
chmod -R -N ~/Documents
rm -rf ~/Documents
ln -s /Volumes/Macintosh*Data*HD/Documents ~/Documents
sng08 is offline   0 Reply With Quote
Old Sep 17, 2010, 07:14 AM   #12
LPZ
macrumors 65816
 
Join Date: Jul 2006
Quote:
Originally Posted by sng08 View Post
Sorry to be a pain, but to clarify the terminal code for moving the folder should be:

Code:
cp -Rp ~/Documents /Volumes/Macintosh*Data*HD
chmod -R -N ~/Documents
rm -rf ~/Documents
ln -s /Volumes/Macintosh*Data*HD/Documents ~/Documents
Glad it worked. The * will match any string of characters, so in particular it matches a single space character. My strong advice is to avoid names that contain space characters. Use something like MacintoshDataHD or Macintosh_Data_HD and problems like this are avoided.

Instead of using the * in the Terminal commands, you should be able to use the space characters, provided you precede each with a \

So the following should work:

Code:
cp -Rp ~/Documents /Volumes/Macintosh\ Data\ HD
chmod -R -N ~/Documents
rm -rf ~/Documents
ln -s /Volumes/Macintosh\ Data\ HD/Documents ~/Documents
Quote:
Also, is it worth moving that folder back to the home and just move the entire HOME folder over or just individually move folders that I require over to the second internal hard drive?
Not sure which option is better, if either.
LPZ is offline   0 Reply With Quote
Old Sep 17, 2010, 08:04 AM   #13
mmulin
macrumors 6502
 
Join Date: Jun 2006
Quote:
Originally Posted by sng08 View Post
So to move the folder, the symbolic link requires the * to denote a space?
Actually, '*' is used as a wild card character in most shells to replace any number of characters. The correct way would be to tell bash shell that there is a literal space between the words by escaping the space. Otherwise bash reads it as another argument to the preceding command.

string1\ string2
..denotes that string1 and string2 are actually one string containing the space character. Analogue, you can escape any special character if need (i.e. \* = literal * and not the wildcard mentioned above)
__________________
the net is vast and infinite
:x1c, pb2400c, 4gs
mmulin is offline   0 Reply With Quote
Old Sep 17, 2010, 07:59 PM   #14
sng08
Thread Starter
macrumors member
 
Join Date: Aug 2010
Thank you so much for your help guys. I'm slowly starting to understand the whole symbolic link idea in terminal...(I think!)

I've managed to move the necessary folders over to the second internal HD and I believe are all operational.

Although one last query if I may: Within my Home directory I still see the Documents/Downloads/Pictures folders except with a small arrow on the bottom left corner which leads to the actual folder on the second HDD (thus creating a symbolic link). Although I thought with the "rm -rf ~/Documents" command I deleted the folder? I shouldn't really be concerned as it's a link to the actual folder rather than a folder which holds data? Thanks.
sng08 is offline   0 Reply With Quote
Old Sep 17, 2010, 08:25 PM   #15
LPZ
macrumors 65816
 
Join Date: Jul 2006
Quote:
Originally Posted by sng08 View Post
Thank you so much for your help guys. I'm slowly starting to understand the whole symbolic link idea in terminal...(I think!)

I've managed to move the necessary folders over to the second internal HD and I believe are all operational.

Although one last query if I may: Within my Home directory I still see the Documents/Downloads/Pictures folders except with a small arrow on the bottom left corner which leads to the actual folder on the second HDD (thus creating a symbolic link). Although I thought with the "rm -rf ~/Documents" command I deleted the folder? I shouldn't really be concerned as it's a link to the actual folder rather than a folder which holds data? Thanks.
Code:
rm -rf ~/Documents
removed the original Documents directory from your Home directory.
Code:
ln -s /Volumes/Macintosh*Data*HD/Documents ~/Documents
created a symbolic link named Documents in your Home directory; this symbolic link item is displayed by OS X as a folder with a small arrow in the corner. There is no Documents directory/folder in your Home folder. You can verify this by entering

Code:
cd ~; ls -l
in Terminal. A line that begins with a "d" is a directory; a line that begins with a "-" is a file; a line that begins with an "l" is a link, as in this snippet:

Code:
drwxr-xr-x   2 root   staff    68B Dec 10  2008 libxslt-plugins
-rwxr-xr-x   1 root   staff   240K Dec 10  2008 libxslt.1.1.22.dylib
lrwxr-xr-x   1 root   wheel    20B Feb  8  2009 libxslt.1.dylib -> libxslt.1.1.22.dylib
There's nothing for you to be concerned about.
LPZ is offline   0 Reply With Quote
Old Apr 23, 2011, 10:45 AM   #16
greenland
macrumors newbie
 
Join Date: Apr 2011
Undo symbolic link??

So this method worked for me. I just partitioned my HD and linked folders over.

HOWEVER, i liked my desktop to the partitioned HD and causes problems, saying "operation can't be completed"

SO, what do i have to do to undo the symbolic link i created??


Thanks in advance
greenland is offline   0 Reply With Quote
Old Apr 23, 2011, 10:53 AM   #17
plinden
macrumors 68040
 
plinden's Avatar
 
Join Date: Apr 2004
Quote:
Originally Posted by greenland View Post
SO, what do i have to do to undo the symbolic link i created??
Code:
unlink <sym link>
where <sym link> is the name of the link, not the file being linked to.
plinden is offline   0 Reply With Quote
Old Apr 23, 2011, 11:03 AM   #18
greenland
macrumors newbie
 
Join Date: Apr 2011
Quote:
Originally Posted by plinden View Post
Code:
unlink <sym link>
where <sym link> is the name of the link, not the file being linked to.
I don't understand. I'm getting this response:
-bash: syntax error near unexpected token `newline'

This is what i typed in to create the link

cp -Rp ~/desktop /Volumes/Files
chmod -R -N ~/desktop
rm -rf ~/desktop
ln -s /Volumes/Files/desktop ~/desktop

Last edited by greenland; Apr 23, 2011 at 11:08 AM.
greenland is offline   0 Reply With Quote
Old Apr 23, 2011, 11:08 AM   #19
plinden
macrumors 68040
 
plinden's Avatar
 
Join Date: Apr 2004
Quote:
Originally Posted by greenland View Post
I don't understand. I'm getting this response:



-bash: syntax error near unexpected token `newline'

This is what i typed in to create the link

cp -Rp ~/desktop /Volumes/Files
chmod -R -N ~/desktop
rm -rf ~/desktop
ln -s /Volumes/Files/desktop ~/desktop
You must have made a typo - what did you type in the unlink?

The Desktop folder starts with 'D' not 'd' - presumably that's a typo too?

Edit: by the way, when you get rid of the link, logging out and back in again should rebuild your Desktop folder and you can bring the files back. As mentioned earlier in this thread, you'd be better to move your whole home directory.

Last edited by plinden; Apr 23, 2011 at 11:14 AM.
plinden is offline   0 Reply With Quote
Old Apr 23, 2011, 11:34 AM   #20
greenland
macrumors newbie
 
Join Date: Apr 2011
Quote:
Originally Posted by plinden View Post
You must have made a typo - what did you type in the unlink?

The Desktop folder starts with 'D' not 'd' - presumably that's a typo too?

Edit: by the way, when you get rid of the link, logging out and back in again should rebuild your Desktop folder and you can bring the files back. As mentioned earlier in this thread, you'd be better to move your whole home directory.
Yes, that was a typo - should be a capital D
I just deleted both symbolic links (after moving everything to a temp folder). Logged back in and copied the old desk top items back.

I guess i could create symbolic links of individual folders on my desktop to the other driver, a pain yes, but that's the only other option i see (other than as you suggested - moving Home dir)

thanks for your help
greenland is offline   0 Reply With Quote
Old Jun 30, 2011, 04:48 PM   #21
sambuev
macrumors member
 
Join Date: May 2011
Location: TO,ON,CA
Hello guys, I have MacBookPro 17,2001 with 128 SSD (from Apple) and another second hard drive on Optibay - 750GB.

Please can you show me, how can I move my
1. Documents
2. Downloads
3. Music
4. Movies
5. Pictures
6. Sites

to another hard drive.



Can you give me a Terminal commands?
Thank you!
sambuev is offline   0 Reply With Quote
Old Jul 29, 2011, 12:04 AM   #22
shinsundo
macrumors newbie
 
Join Date: Jun 2010
error after symlink?

Hello,

Being a newbie at Terminal, I have no idea what I'm doing. Thought everything went well but when clicking on symlink, I get

"The operation can’t be completed because the original item for “Documents” can’t be found." error.

Any help is appreciated!
shinsundo is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > OS X

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Anyone know if it is possible to create a symbolic link to a folder within a package? pruppert OS X 10.8 Mountain Lion 2 Apr 27, 2013 04:10 PM
Repairing symbolic link with 2 HD set up after HD swap robcommon Mac Basics and Help 3 Mar 14, 2013 06:53 PM
Move Home folder to externall HDD or move only Music, Movies, Pictures and Documents? Lehcim OS X 3 Dec 6, 2012 04:35 PM
Weird finder problem for 'Documents' folder dem466 iMac 6 Nov 6, 2012 01:14 PM
Reminders not working when ~/Library/Calendars is symbolic link kubaw OS X 10.8 Mountain Lion 1 Aug 14, 2012 03:53 PM

Forum Jump

All times are GMT -5. The time now is 09:16 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC