Created
December 23, 2011 18:54
-
-
Save lpar/1515061 to your computer and use it in GitHub Desktop.
Locate files on Mac OS X which have resource forks
This file contains 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/env ruby | |
# encoding: UTF-8 | |
# Utility for Mac OS X to locate files which have resource forks, and which | |
# therefore might be corrupted by being transferred via a non-Mac filesystem. | |
require 'find' | |
if ARGV.length != 1 | |
puts "usage: forkboy <dir>" | |
puts "Reports files under the specified directory which have resource forks." | |
exit 0 | |
end | |
Find.find(ARGV[0]) do |file| | |
rsrc = "#{file}/..namedfork/rsrc" | |
if File.exist?(rsrc) && File.lstat(rsrc).size > 0 | |
puts file | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment