4

I want to replace the folders in my home/ directory with symlinks to folders in another location, but I want to retain the folder emblems without having to go searching for them. How do I do this?

To illustrate what I'm asking, the directories in the home folder have nice emblems that look like this:

Music folder with music emblem

If I just delete this folder and replace it with a symlink the music emblem is lost and replaced by a link emblem.

Music symlink with link emblem

I want it to have have both the music emblem and the symlink emblem, like this:

Music symlink with music and link emblems

Preferably I'd like to be able to do this without having to manually hunt down and set the icon for the folder (but a good answer explaining how to do so would be upvoted as a good alternative).

1 Answer 1

5

For Ubuntu 18.04:

In 18.04 you can no longer paste/merge symlinks over directories (with good reason). Luckily, if you delete the home folder sub-directories (documents, downloads, etc.) and replace them with symlinks, the icons will automatically reappear if the names are the same.

Prior to Ubuntu 18.04:

This can be done using the "merge folder" functionality of Nautilus (the default file browser in Ubuntu).

Simply create the symlink in another location with the same name as the folder you want to replace, then copy and paste it into your home folder.

A dialog will appear asking if you want to merge the folders and you should click the Merge button and you will now have a new symlink with name and folder emblems of the old folder.

WARNING: From my testing, this doesn't appear to be a true 'merge' (it's more like a useful--albeit potentially dangerous--bug), any files or subdirectories in the folder you are replacing with the symlink appear to be deleted (aka, only replace empty folders if you don't want to lose files). Proceed with caution!

WARNING: Also, absolutely do not replace a folder that itself contains symlinks or it will follow the symlinks and recursively delete everything in the target directories.

Merge Folder Dialog

This gets the job done, but if someone knew a command line alternative with the same results I would be very happy.

2
  • This is dangerous, since it can lead to this: askubuntu.com/questions/666234/… Sep 18, 2015 at 9:49
  • Thanks for the comment. I do note in the solution though that this is taking advantage of a bug and provide two warnings about what could go wrong if you aren't careful. I'd love to see--and would happily accept--another answer with a less risky solution though. Oct 1, 2015 at 14:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .