Created
November 11, 2018 10:19
-
-
Save hyjk2000/4042f8dba1c7aa76a232244959a199c4 to your computer and use it in GitHub Desktop.
Remove orphan JPG files which are not accompanied with CR2 files
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
| # requires recycle-bin: https://github.com/sindresorhus/recycle-bin | |
| orphan_files = Dir.glob('*.JPG').reject do |jpg_file| | |
| File.exist? "#{File.basename(jpg_file, '.*')}.CR2" | |
| end | |
| puts "Removing #{orphan_files.size} orphan files: " | |
| orphan_files_join = orphan_files.join(' ') | |
| puts orphan_files_join | |
| exec "recycle-bin #{orphan_files_join}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment