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

 LINKS

 CONTACT


Atom Feed
RSS Feed


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
/mac
/misc
/nix
/palm
/windows

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

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

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