Last active
February 3, 2023 19:23
-
-
Save esaborit4code/e6bb241791e943d92ca5431743d1b95b to your computer and use it in GitHub Desktop.
Sloppy script to remove unedited photos from iPhotos export
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
require 'fileutils' | |
def basename(file) | |
File.basename(file, File.extname(file)) | |
end | |
def all | |
Dir.glob('*').map | |
end | |
def edited | |
Dir.glob('*.AAE').map{ |filename| filename.gsub('.AAE', '') } | |
end | |
def unedited | |
all.reject { |filename| edited.include? basename(filename) } | |
end | |
to_remove = unedited | |
puts "Press ENTER to remove #{to_remove.count} files. Press CTRL + C otherwise." | |
gets | |
FileUtils.rm(to_remove, verbose: true) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment