View Single Post
Quote:
Originally Posted by Ken Case View Post
Here's a zsh one-liner which tests to see which of your linked OmniFocus attachments still exist at the same path:

Code:
for file in "$HOME/Library/Application Support/OmniFocus/OmniFocus.ofocus"/*.zip; do; unzip -p $file contents.xml | xmllint -format - | grep 'cell href='; done | sed 's/.*<cell href="//' | sed 's/".*//' | while read url; do; if curl -s -I $url > /dev/null; then; echo Found $url; else; echo Lost $url; fi; done
If you want to just see the lost URLs, you could do this:

Code:
for file in "$HOME/Library/Application Support/OmniFocus/OmniFocus.ofocus"/*.zip; do; unzip -p $file contents.xml | xmllint -format - | grep 'cell href='; done | sed 's/.*<cell href="//' | sed 's/".*//' | while read url; do; if ! curl -s -I $url > /dev/null; then; echo $url; fi; done
Hope this helps!
hmmm. The first one gives me

Lost file://localhost/Users/mlevin/Science/Work%20stuff/Research%20Projects/GOF%20phenotypes%20and%20Vmem%20transduction/Muscimol-gated%20(GABA-Cl)%20stuff/
Lost file://localhost/Users/mlevin/Science/Work%20stuff/Research%20Projects/GOF%20phenotypes%20and%20Vmem%20transduction/Muscimol-gated%20(GABA-Cl)%20stuff/
Lost <lit>[for file in
Lost file://localhost/Users/mlevin/Desktop/TO%20DO/Key%20Levin%20Lab%20papers%20to%20read/
Lost <lit>[for file in
Lost <lit>[for file in
Lost <lit>[for file in
Lost <lit>[for file in
Lost <lit>[for file in
Lost <lit>[for file in
Lost <lit>[for file in
Lost <lit>[for file in
Lost <lit>[for file in
Lost <lit>[for file in
Lost <lit>[for file in
Lost <lit>[for file in
Lost <lit>[for file in
Lost <lit>[for file in
Lost <lit>[for file in
Lost <lit> for file in
Lost <lit> for file in
Lost <lit> for file in
Lost <lit> for file in
Lost <lit> for file in
Lost <lit> for file in
Lost <lit> for file in

so there's something weird at the end. Also the second one gives me the same thing. Is there any easy way to convert the file URLs to a pathname (get rid of the %20 etc.) so I can check easily if the file actually exists?

thanks

Mike