Reputation: 13
I hope I have searched good enough in order to ask this questions.
I have this code to clean up some default files in our team drive, if somebody got them in sync by accident...
In this case desktop.ini
function cleanup(){
var folderID = 'FOLDERID';
var search = 'title Contains "desktop.ini"';
var fileIDs = [];
var files = DriveApp.searchFiles(search);
while (files.hasNext()){
files.next().setTrashed(true);
}
Logger.log('fileIDs.length + ' files have been moved to trash');
}
Is there a way to add multiple hits in one search?
What if I would want to add other files like "thumbs.db" or from the mac guys ".DS_Store". Do I need to search for everything individually or is there a .gitignore way to solve it?
Upvotes: 1
Views: 290
Reputation: 201378
How about this? When you want to retrieve the files with the filenames which contained "desktop.ini", "thumbs.db" and ".DS_Store" in one search using DriveApp.searchFiles()
, you can achieve it using or
operator as follows.
var search = 'title contains "desktop.ini" or title contains "thumbs.db" or title contains ".DS_Store"';
Upvotes: 2