5

I have located a file very deep in a folder structure in a Shared Drive in Google Drive (web interface). The file is in a location like this:

alpha > beta > gamma > delta > ... > kappa > fileImInterestedIn.txt

Is there any way how I can get this path as a text string and copy it so that I can paste it elsewhere? I have do do this again and again. Manually copying the path by typing is tedious and error-prone.

3 Answers 3

4

You need a coded solution

You will need either a Google Apps Script, a 3rd party application, or a browser extension because the Drive web application doesn't include the functionality you want.

Though the web application may lack a feature you desire simply because of design decisions, Google makes available its Drive API, which enables amateur and professional developers to access and extend Drive functionality using their own custom programs.

This can be as simple as writing your own Google Apps Script to retrieve the plain text path of file from Drive, or it could be a 3rd party developing an application with a more comprehensive set of tools.

Assuming you don't want to take on the daunting task of of coding your own solution, the alternative (and my recommendation) is to use a 3rd party solution that meets your needs.

Warning about 3rd Party Apps

You should always do your your own proper due dilligence prior to installing anything from a third party, whether an extension, an application, or a script. I have included some of my observations related to Drive Explorer at the bottom of the post.

Suggested Application: Drive Explorer

After a quick review of some options, I am suggesting you install Drive Explorer which can be downloaded from the Google Workspace Marketplace.

I am not affiliated with Drive Explorer in any way, however it has a lot of Drive-related features including the ability to list file paths.

In the article How to Get & Copy Path of Google Drive Files & Folders they explain how to accomplish what you want using Drive Explorer:

  1. Right-click one or more files on your Google Drive.
  2. Select Open with → Drive Explorer.
  3. In the tab opened, select Fetch files and authorize Drive Explorer.
  4. You will see the file path in one of the columns.
    enter image description here

My Observations

A cursory examination of Drive Explorer resulted in the following observations:

  1. The same download URL has existed since at least November 2020 when the Internet archive made this first capture (27 captures made in total).
  2. In 2020 it had ~120,000 downloads, 221 user ratings averaging 4.5 stars (out of 5)
  3. As of 06/14/2023 it has ~563,000 downloads, 502 user ratings averaging 4.6 stars (out of 5)
  4. The download page links to support resources
0
3

An easy workaround is opening a Google Colaboratory Python notebook. To open a Colab notebook, click "+New" on the top left of the Drive homepage then click "More" and click "Google Colaboratory", then mount your Google Drive:

Write these two lines in the first cell of the notebook:

from google.colab import drive;
drive.mount('/content/drive'); # This will prompt for authorization. 

Then from the file explorer window on the left go to content (folders are arranged in alphabetical order) -> drive -> MyDrive -> .... -> the folder/file you want to get the path of.

Next right click on the three vertical dots which show up when you hover your mouse on the file/folder and click "Copy path". This will copy the path in the form of a string in your clipboard.

Then go to any cell of your Google Colaboratory notebook and paste to see that the file/folder path has indeed been copied correctly.

I use this technique often for working with data stored in different folders inside my Google Drive while working in Google Colab.

0
0

Another workaround for this lack of a simple feature would be to right click the file or folder of interest and select 'organize', then 'Add shortcut'. This would allow you to create a shortcut to the file that you can place in a location with a simpler file path (such as directly in the home folder of My Drive). You could then use the path to the shortcut, which would be shorter and easier to copy.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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