Auto-symlink contents of directory in my home directory?

1

So I'm a dual-booter. I'm looking for an easy way to keep up-to-date symlinks in my Linux home folder pointing to every file and folder in the root of Windows personal directory.

So, say I have foo.txt and bar.txt in C:\Windows\Documents and Settings\Nathaniel. I want symlinks of those files to automatically be made in /home/nathaniel/ (while I'm running Linux, of course).

Nathaniel

Posted 2009-12-31T04:45:37.947

Reputation: 3 966

Why not just make a symlink between the Nathaniel\Home directory and Users\Nathaniel directory (assuming your computer username for both OSs is your superuser username, obviously)? – Daniel H – 2009-12-31T04:59:52.397

But this way the whole folder would show up as a symlink, if I read you right. It would show up as /home/nathaniel/nathaniel, wouldn't it? Not quite what I want. – Nathaniel – 2009-12-31T06:12:26.803

No, it would just be /home/nathaniel, but if Ubuntu and Windows name the folders different things, it wouldn't work. – Daniel H – 2010-01-01T00:28:55.400

Turns out putting your home directory on NTFS is a dangerous thing to do. Nice thing is I didn't try it, but found out first. See http://ubuntuforums.org/showthread.php?t=901127 . Guess I'll be sticking with the auto-symlink idea.

– Nathaniel – 2010-01-04T23:32:01.093

Answers

0

For a start, try adding to your .profile (or equivalent file run when you fire up your shell) something along the lines of:

# Mount the NTFS volume at `NTFS`, then...
WINHOME="NTFS/Windows/Documents and Settings/Nathaniel"
ln -s "$WINHOME"/* ~

You might want to consider what should happen if you have another file with that name already in ~; changing it to ln -sf might be good enough.

To keep the mirror current while you're logged in (e.g., to handle the case where you change WINHOME while running Linux), you could schedule that scrap of script to run regularly (using cron, for example), or employ some sort of directory watching daemon that you can use to discover when the directory contents change. (Under Mac OS X, I'd use launchd.)

Jeremy W. Sherman

Posted 2009-12-31T04:45:37.947

Reputation: 606

0

In Windows, you can "move" the Documents, etc. folders. IDK how to do this in XP (if it's possible), but in Vista you just right-click on Documents, Desktop, Videos, etc. and say Properties, and then click Move... under the Location Tab. You can then make these the equivalents in your Ubuntu Home directory.

What Windows version do you have? I might be able to post specific instructions with screenshots.

Daniel H

Posted 2009-12-31T04:45:37.947

Reputation: 1 506

Umm... not quite sure what you're driving at here. I'm just trying to create symlinks, not move my personal folder in my NTFS partition around. – Nathaniel – 2009-12-31T06:08:37.170

If you move them around, they would all be connected. It would automatically read the same data both times. I think that Windows actually does create symlinks in this case. – Daniel H – 2010-01-01T00:25:54.903