TinyApps.Org
Small is beautiful


 HOME

  0. Internet
  1. Text
  2. Graphics
  3. System
  4. File
  5. Misc
  6. Palm
  7. OS X

 BLOG

 DOCS

 FAQ

 RSS (?)





Delete all files except... #
While importing a My Pictures directory from Windows XP into iPhoto via drag-and-drop, the process would crash after several thousand photos. I suspected iPhoto was choking on a non-JPG file, so I recursively deleted all other files in the directory:
Find all files but JPGs:
find . \( \! -iname "*\.jpg" \! -iname "*\.jpeg" -type f \) -print

Find all files but JPGs, and list them on one line:
find . \( \! -iname "*\.jpg" \! -iname "*\.jpeg" -type f \) -print0

Delete all files but JPGs:
find . \( \! -iname "*\.jpg" \! -iname "*\.jpeg" -type f \) -print0 | xargs -0 rm -f
Sure enough, after cleaning the directory of extraneous filetypes, the import worked flawlessly. Use the above commands at your own risk - unintended data loss is likely. As always: backup, backup, backup. (Thanks to Todd for his post, from which the above commands were largely lifted.)

/mac | Nov 15, 2007



Categories
/blosxom
/eink
/mac
/misc
/nix
/palm
/windows

Blosxom Archive
2012: 2 1
2011: 12 11 10 9 8 7 6 5 4 3 2 1
2010: 12 11 10 9 8 7 6 5 4 3 2 1
2009: 12 11 10 9 8 7 6 5 4 3 2 1
2008: 12 11 10 9 8 7 6 5 4 3 2 1
2007: 12 11 10 9 8 7 6 5 4 3 2 1
2006: 12 11 10 9 8 7 6 5 4 3 2 1
2005: 12 11 10

Blogger Archive
2005: 10 9 8 7 6 5 4 3 2 1
2004: 12 11 10 9 8 7 6 5 4 3 2 1
2003: 12 11 10 9 8 7 6

Ezine Archive
2004: 4 3 2 1
2003: 12 9 8 7 6 5 4 2 1
2002: 12 10 9 8 7 6 5 3 2 1
2001: 12 11 10