How do I determine that a folder really exists in a Streamed Google Drive?

53 views Asked by At

I have a Google Drive that had a large number of changes accidentally made to its file and folder structure externally, which I am trying to undo. I am trying to run a Python script on a Windows machine (disconnected from the Internet, so not currently syncing said Google Drive) that has a previous version of the folder structure preserved, to get a list of all folders and files in the drive. However, the issue is that the most files and folders in the Drive are "streamed", which is to say they are not really on my machine, and only exist as markers.

I tried a number of methods, including built-in OS commands (like dir), to list the folder structure, but they all hang up on specific folders. I attempted to use Python os.walk() as well as os.scandir(), but the same thing happens. For certain folders, even though every method confirms their existence (os.path.exists(), etc), when they are scanned, the script hangs up, and after a long while, times out with "[WinError 2] The system cannot find the file specified".

Is there a way to tell, without a timeout, whether these folders really exist before I get stuck scanning them?

0

There are 0 answers