Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Windows 7 has a concept they call "Libraries." It's a folder that links to other folders. The "libraried" folder will display the contents of all the folders it links to. So if folder-A contains video of Jimmy's October Soccer games and folder-B contains video of Jimmy's November Soccer games, I can link folder-A and folder-B to the Library-folder and view thumbnails of all the October & November videos in one folder.

I find this useful and was wondering if it's possible to configure a similar thing in Ubuntu? It seems like I should be able to use mount to pull this off somehow but I don't know how.

share|improve this question

3 Answers 3

This sounds like the concept of Virtual Folders that has been part of Gnome since v2.14

Let me explain:

My Music folder has several folders of MP3 files (not choosy about my music!)

enter image description here

As you can see - you can search for all mp3 files and then save that search:

enter image description here

Now you can open that search from Nautilus - any new files appearing in the searched folders will automatically appear in the Nautilus view when you hit the refresh button.

enter image description here

share|improve this answer
    
Problem is though that this will pull mp3s from all over the system, not just from the specific folders I want. Plus what if I have some mp3s and some .WMAs in the same folder? This will only pull the mp3s from the folder, not the WMAs also. I appreciate the answer though. –  Chad--24216 Oct 20 '11 at 14:07
    
this would work if Nautilus could search Tags attached to the music files. –  Chad--24216 Oct 20 '11 at 14:24

We will be adding a submenu "Add to Library" to the Scripts menu.

First, check your version of Nautilus:

nautilus --version

Depending on the output, open folder:

  • ~/.local/share/nautilus/scripts - for versions of Nautilus >= 3.6
  • ~/.gnome2/nautilus-scripts - for versions of Nautilus < 3.6

In this folder, create a file Add to Library and add the following code to the file:

#!/bin/bash
IFS='
'
sourceDir="`zenity --file-selection --directory --title="Select Source Directory"`"
if [[ -z "$sourceDir" ]]; then
exit 0
fi
destDir=$(echo "$NAUTILUS_SCRIPT_CURRENT_URI" | sed -n 's/[a-z]*.\/\///p')
cd $sourceDir
for file in *; do
ln -s "$sourceDir/$file" "$destDir/$file"
done

Open terminal and give execution rights to the file:

chmod +x "/path/to/script/Add to Library"

Note: Visit the Scripts folder to let Nautilus know about the Script:

Right click (anywhere) -> Scripts -> Open Scripts Folder

Now, go to the folder that you want to use as a Library.

Right click (anywhere, inside the folder) -> Scripts -> Add to Library Choose the Folder that you want to include in the Library - Click OK.

You should be able to see links to all the Files/Folder of the Source Directory. Add as many sources as you want.

share|improve this answer

This is hardly ideal, but it is a workaround based on fossfreedom's post (sorry, I don't have the reputation to post a comment on an answer).

Create a folder somewhere that you don't mind keeping it, but is out of the way. Put links to all the folders you would like in your library into this newly created folder.

Now, do a nautilus search in the newly created folder, and search for " " (i.e., search for the space character, which for some reason seems to be the wildcard in nautilus searches). This will search for everything in that folder recursively (and following the links).

Save the search as fossfreedom described.

This has the advantage of getting all files, not just ones matching a specific search term, and the advantage of only looking in specified folders. It still suffers the disadvantage of not maintaining the file structure (I think).

Having said all that, I can't seem to open a saved search in 11.10.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.