Google Drive Trash Cleaner is a command line program that can do exactly what the title says. It’s available as a Windows or Python executable from GitHub
In my example I downloaded it on a computer that doesn’t even have Google Drive Backup & Sync. When I ran it I was prompted that I needed to run it with a “no authorization” command line. Once I did that it gave me a link to Google with a very long url. By visiting that link I was able to login to Google, confirm that I wanted Drive Trash Cleaner to have access and receive an authorization number.
Once I provided the authorization number to the app, it accesses the drive perfectly.
Using the simple command of cleaner -d 1 -a the utility connects and deletes any files/folders older than 1 day in the recycle bin.
By default it deletes items over 30 days old. “-d” allows your specify the number of days. “-a” will cause it to automatically delete without requiring authorization.
Full usage and syntax are shown below
usage: cleaner [-h] [-a] [-v] [-d #] [-q] [-t SECS] [-m] [–noprogress]
[–fullpath] [–logfile PATH] [–ptokenfile PATH]
[–credfile PATH]
optional arguments:
-h, –help show this help message and exit
-a, –auto Automatically delete older trashed files in Google Drive without prompting user for confirmation
-v, –view Only view which files are to be deleted without deleting them
-d #, –days # Number of days files can remain in Google Drive trash before being deleted. Default is 30
-q, –quiet Quiet mode. Only show file count.
-t SECS, –timeout SECS Specify timeout period in seconds. Default is 300
-m, –mydriveonly Only delete files in the ‘My Drive’ hierarchy, excluding those in ‘Computers’ etc.
–noprogress Don’t show scanning progress. Useful when directing output to files.
–fullpath Show full path to files. May be slow for a large number of files. NOTE: the path shown is the ‘current’ path, may be different from the original path (when trashing) if the original parent folder has moved.
–logfile PATH Path to log file. Default is no logs