Skip to content

Instantly share code, notes, and snippets.

@mshock
Last active August 29, 2015 14:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mshock/b24b6cf6d3e17a6224a7 to your computer and use it in GitHub Desktop.
Save mshock/b24b6cf6d3e17a6224a7 to your computer and use it in GitHub Desktop.
backup and delete original files by size in target directory - cleanup reddit wallpaper stash populated by IFTTT
function wallpaper_cleanup() {
var folder = DriveApp.getFoldersByName("wallpapers").next();
var small_folder = DriveApp.getFoldersByName("small_wallpapers").next();
var files = folder.getFiles();
while (files.hasNext()) {
var file = files.next();
if (file.getSize() < 200000) {
file.makeCopy(small_folder);
file.setTrashed(true);
Logger.log(file.getName() + file.getSize());
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment