In Google Drive, is there a way to search only the contents of files within a particular folder (instead of files within the entire drive, as is the default)?
Google just announced that now they included a the search within folder feature.
From the above link:
You can now search for content in a specific folder in Google Drive. Select the drop-down in the search bar and choose the folder you want from the Location menu, or right-click on a folder and search within that folder. Only folders that are within your My Drive or within Team Drives can be searched; if you have a folder that is shared with you, first add the folder to your My Drive.
As of the date of this post, Google Drive does not support searching within a specific folder. However, the new Docs, Sheets, and Slides home screens do have a way to let you do this via the File Picker search interface:
Go to: https://docs.google.com
Click the File Picker folder icon on the right side of screen.
Navigate to the specific folder that you want to search.
Now put your query term in the file picker's search box and hit 'Enter' (Or click the 'Search for all items containing ')
Your search results will only come from the folder you selected.
Note: you can still filter by file type in the File Picker search bar by clicking the drop down arrow.
-
1
-
1This is a rather convoluted way of doing it and ignores people who mostly use drive.google.com. Obviously the view count of this page shows that missing folder searching in their interface was very short sighted on Google's part. Sigh. – deltaray Sep 7 '16 at 18:13
-
@deltaray I'm guessing somewhere at Google there is some risk analysis regarding features, e.g., cost of implementing+maintaining a feature vs benefit in data acquisition. – Fuhrmanator Nov 1 '16 at 15:12
-
Unfortunatelly, this doesn't search subfolders nor does it allow wildcards / requires full keyword. For illustrations and more details: quora.com/… – cregox Dec 3 '16 at 8:40
-
1@SuperUberDuper This can (now) be seen by, after entering your search query in drive search, hitting enter, selecting the file below the search bar and viewing the details of the file (icon that looks like an "i", then choose the details tab (as opposed to the activity tab)). If the file has a parent (location) it will be listed there next to the folder icon. – Jacob Akkerboom Feb 13 '19 at 13:12
Simply star the folders or particular files that you wish to search and then search "is:starred". Unstar them once you want to search something else. It's a little impractical, but it's what I do to search my journal articles, 1000s of which I've stored on my Drive.
A time-consuming work around, which isn't so painful if there are just a few folders you want to search, is to share those folders with other Google accounts, and then include to: thatgoogleaccount@example.com
in your search.
The script in user165768's answer also works. It asks you to share a scary bunch of permissions, so you may want to look at the code at https://github.com/ljv5555/drive-folder-search/tree/gh-pages/app to reassure yourself, and possibly make your own copy.
I wrote an app to search by folder (within file contents). It is a bit slow so be patient when it is loading.
https://script.google.com/macros/s/AKfycby6G32K-vKCiLmoKvMtG64cYPHEREEx1PY5IoYrEYaR6WAfbXs/exec
You can take a look to the following tool: www.evenbytes.com/metadrive.html
This tool will help you to search within Google Drive Folders. In addition to that, the tool provides additional features such as filters or custom metadata.
-
When I try to "install" it, it prompts me to create a Google Apps for Work account. – Clay Nichols Aug 19 '15 at 21:58
-
I have written a simple Python script that can tag your files with folder, after which you can easily search by folder just by typing folder:folder_name
or folder:absolute_path
. You can get my code from here: https://github.com/songxf/drive-search-by-folder
-
so, it basically adds the folder path into description, pre appended by "SBFTK:folder:", and replaces it for when you move files around and run again, right? not too shabby! but what is sbftk? – cregox Dec 3 '16 at 10:27
-
@cregox My guess:
sbftk
is search by folder something something, maybe search by folder tag something. – Larry Engholm Jan 26 '17 at 19:29
I don't think there is such a feature available in Google Drive yet, but you can do a workaround.
If you do not intend to search for files recursively, simply just open the folder you want to search in and use the browser function (Ctrl+F) to search the name of your desired file.
Of course using this method you can't search within the file itself for text matches.
-
2Yes, unfortunately I want to search content within files, not just filenames. I'm also looking to be able to recursively search within a folder (including subfolders). Thanks for the suggestion, though! – Jon Schneider Feb 11 '13 at 21:42
There is another workaround that does not require any third party app or extension.
- Remove your folder (in which you wanna search something)
- Search with is:trashed filter. For example:
is:trashed query_string
- Restore your folder back
-
For me, this only finds FOLDERS that are trashed, but not anything WITHIN those folders. – Dan Aug 26 '17 at 10:48
One solution: gdrive, which is a CLI for Google Drive.
To find items in a given folder, you use
gdrive list -q "'folderID' in parents"
To get the folderID, navigate to the folder in GDrive, then from the URL copy the ID, e.g., if I go to my folder "Pictures" the URL is
https://drive.google.com/drive/u/8/folders/0B1FVU07aR9pFcDhFbUdkdhF9Oam8
So the folderID
is 0B1FVU07aR9pFcDhFbUdkdhF9Oam8
gdrive
allows you to use all the search capabilities of the API which are far more robust than the GUI.
However, this doesn't seem to be recursive, i.e., it only finds direct children of the given folder, not anything deeper.
What's interesting, and worth exploring, is that if I use a folderID and search from the GUI like "in:0B1FVU07aR9pFcDhFbUdkdhF9Oam8"
then Google Drive shows the correct name of the folder almost like a filter in the GUI!
But it does NOT really work; I cannot find anything in the folder, and the GUI shows this error at the bottom of the screen:
Maybe someone can figure out a way to get this to work as expected.
Search within a folder is now available as of January 2018.
You can right-click on a folder name and Select 🔍 Search within folder_name
and it'll let you do so from the search bar of Google drive.
You can right-click on a folder from:
- Left navigation panel
- Folders inside My Folder
- Upper navigation helper
- Folder from 'Shared with me'
- Second level folders from one of your synced 'Computers'
If you don't like clicking through the folder selector in the Location
drop-down, you can use the parent:
search operator in the Search box with the Folder ID.
For example, if f0LdEr-1D_abcdefghijklmnop
is the folder ID you see in the address bar when you open the folder, add parent:f0LdEr-1D_abcdefghijklmnop
to the search box.
When you hit Enter, parent:f0LdEr-1D_abcdefghijklmnop
will disappear from the Search box, but it will still be visible in the URL. Right below the search box, you will see "Searching in 📁Foldername ✖
" (where Foldername
is the name of the folder).
If you want to search for text inside the files, you could search your drive for the text, then use (Ctrl+F) to search for the folder name. A little messy, though, and again, not recursive!
I have had very inconsistent success with:
in:<foldername>
This is somewhat inconsistent though.
This is how Google lets you search your Trash: e.g. before:2013-06-01 in:Trash
Another solution – if you have a G Suite account – is to use a Team Drive. You can create a new Team Drive, not share it with anyone, and move folders into it. Then you can narrow your search to only the Team Drive.
in:folder_name
operator (e.g.in:folder_name search_term
. Found here. – Alex Feb 4 '13 at 18:02