Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'find'
- def handle_dir(dir)
- Find.find(dir) do |entry|
- if File.file?(entry)
- handle_file(entry)
- end
- end
- end
- def handle_file(file)
- if `file "#{file}"` =~ /SQLite/
- `echo "VACUUM;" | sqlite3 "#{file}"`
- `echo "ANALYZE;" | sqlite3 "#{file}"`
- end
- end
- location = ARGV.shift
- if location != nil
- if File.file?(location)
- handle_file(location)
- else
- handle_dir(location)
- end
- else
- handle_dir(Dir.getwd())
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement