As I’ve been using Illustrator I’ve found it’s very common to need to reuse elements in new documents. As all of my projects consists of folders within folders many layers deep it can take a bit of time to navigate to the correct folder to find the file I need. I’d also have to make sure I either opened and old file and copied out what I needed without making any changes (or worse, damaging the document) or I would make a copy and open that, but then need to remember to delete it later.
What I wanted was a destructible copy of all my old files I could easily browse through, open, mangle, destroy, etc. with no affect on my workflow. I’ve got something that seems to work for now. (Until I come up with something better.) My original plan was to construct a Perl or Python script to walk the directory and copy any Illustrator files (with the .ai extension) to another folder named EXAMPLES. Before I got started writing code I did a few searches, first wondering if rsync
could it, and it can, but it didn’t seem elegant. I ended up reading a bunch of posts about how to do this and I didn’t bookmark the page that had the closest solution, but my script is below.
#!/bin/sh /usr/bin/find /Users/pete/Projects/ -name '*.ai' -exec cp -p \{\} /Users/pete/EXAMPLES/ \; # copy just the .ai files
Difficult to read the code? See the gist on GitHub.
Yup, the good old find
command to the rescue. It’s not perfect, as files might overwrite other files if the names are not unique. In this case if names are the same, it’s probably because I’ve got the same source file in multiple locations. With a bit more code I could deal with that, but again, doesn’t matter for this use case.
The nice thing about this is that I can just create a cron job to run it every night and I get all the fresh files copied into in the EXAMPLES folder ready to reference. The files are (mostly) tiny so it takes very little resources or space.
This is one of those things I’m posting because there’s a 97% chance I’ll find this useful in the future. And if anyone else finds it useful… You’re Welcome! Keep Being Awesome.