(You could use "M\t" for folders with a megabyte size.) These largest folders are stored in "GB.txt". That isolates the folders which are at least 1GB large. Then, "G\t" is the string which is searched for (a capital G, followed by a tab), and that line is printed. Note that the -h option (as opposed to -sh) displays sub-folders. ! du -h /content/drive/My\ Drive/* > all.txtĪll the folder sizes will be saved in "all.txt". You will need to authenticate the Google Drive File Stream to access your Google account, and copy the authentication token into the Colab notebook. In Google Colab, create a new notebook, click on the "Files" icon in the left sidebar, and "Mount Drive". I provide improved code below, which can display only the largest folders. This answer was inspired by Aditya, so please upvote his answer there. UPD: the script was updated so that if it runs too long and is stopped, just run it once more and it will resume from where it left, using data stored in "Getting Folder Sizes. tName("Getting Folder Sizes, " + report.length + " processed.") Or you can just copy and paste the code into Google Script editor and run "doGet()" function from there: function doGet()) Other is the report which lists all folders and sizes. It will create two files in the root of your Drive, one displays progress and is deleted after script is completed. (if it gets stopped, just run it once again, and it will continue from where it left) UPD2: if you have a lot of files it will reach the execution time limit and stop you will need to run it multiple times (you can also set up automatic timed trigger for this) And verification requires some extra effort, so I didn't do it yet. UPD: as Google started to block unverified scripts, the only way to use it is copy-paste the source to your script editor.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |