-
-
Save vernalkick/3f7aad667e961953f3e415d08dd1dfe4 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby | |
# Input arguments | |
source_path = ARGV[0] | |
destinationPath = ARGV[1] || '~/Desktop/ember_backup' | |
# Creade destination directory if it doesn't exist | |
`mkdir -p #{destinationPath}` | |
# Find the embersnaps in the directory and count them | |
ember_snaps = Dir["#{source_path}/*.embersnap"] | |
ember_snaps_count = ember_snaps.count | |
number_of_files_successfully_copied = 0 | |
files_not_copied = [] | |
# Loop through the snaps, find the media file and copy it to the destination | |
ember_snaps.each_with_index do |file, index| | |
image_file = Dir["#{file}/*.{png,PNG,jpg,JPG,jpeg,psd,gif,mov,svg}"][0] | |
if image_file == nil | |
files_not_copied << file | |
next | |
end | |
print "Copying file #{index + 1}/#{ember_snaps_count}...\r" | |
`cp '#{image_file}' #{destinationPath}` | |
number_of_files_successfully_copied += 1 | |
end | |
# Let the user know it's done! | |
puts "Done! #{number_of_files_successfully_copied} of #{ember_snaps_count} files copied." | |
# If there's been any errors, let the user know | |
if number_of_files_successfully_copied > 0 | |
puts "\n#{files_not_copied.count} file#{'s' if files_not_copied.count > 1} could not be copied:" | |
files_not_copied.each do |file| | |
puts "- #{file}" | |
end | |
end |
I copied one of the .embersnap files, changed the format to .jpg, opened the folder and I can see the jpg.
Not sure what your script does. Is it the equivalent of doing what I just did, but as a batch processor?
Super helpful! Thanks.
Thanks to your script I could save a library that I had been saving for a decade! thank you!
Thanks for this
Thank you very much for this, finally restored a huge library which I thought was lost.
Hi Vernalkick, after a long odyssey of looking for an alternative to ember I've found Eagle which works very similar to Ember. Yet, transfering the library from Ember to Eagle is manually impossible. Do you think it's possible to write a script, that copies all metadata like tags, notes and URLs to IPTC tags which the could be imported to Eagle...?
For the past few years I've been collecting design inspiration in Ember. Sadly, Realmac has stopped development of Ember without giving users a good way to export their Library from High Sierra where the app just crashes on launch. Thankfully, the folder structure of the Ember library is pretty straightforward and contains all of the original image files.
This script automates the process of exporting your library so you don't have to copy each file manually.
How it works
Here's an example of how it works in practice:
If you don't include a target path (as you see above), your images will be copied to a
ember_backup
folder on your desktop.