as per post, need script delete google drive files.
i new using google drive realtime api, , have created , saved hundreds of realtime files drive during testing. if go drive in standard way through browser, doesn't load (40 minutes , counting); that's how clogged is.
the files created code: (using google drive api)
createrealtimefile: function(title, callback) { var = this; window.gapi.client.load('drive', 'v2', function() { var inserthash = { 'resource': { mimetype: that.mimetype, title: title } }; window.gapi.client.drive.files.insert(inserthash).execute(callback); }); }, they saved, i'm assuming, https://www.googleapis.com/drive/v2/files/file_id fileid collection of characters such - "0b6sz2swz13-qzlnurlbxq1nuwja"
however, want delete files created yesterday (july 9, 2015 1am, july 10, 2015), not delete of drive! there way this?
well, can't use browser, it'll have script or through terminal. , in fast/automated fashion. grateful!
i don't know how in drive api, on gas, , since can't access files, , can't create script file, here's script created , shared. code in (also below, in case deletes it) logs name of files created till 24 hours after july 9th:
function deleterecentfiles() { var oldestdate = new date(2015, 6, 9), newestdate = new date(2015, 6, 10), filesroot = driveapp.getfiles(), currfile, datefilecreated; while(filesroot.hasnext){ currfile = filesroot.next(); datefilecreated = currfile.getdatecreated(); if( datefilecreated > oldestdate && datefilecreated < newestdate ){ logger.log(currfile.getname()); // uncomment send file trash bin //currfile.settrashed(true); } } } it won't able delete files in first run, after timeouts (6 minutes), run again after 6 minutes untill files deleted.
Comments
Post a Comment