Skip to content

Instantly share code, notes, and snippets.

@rbrooks
Created June 11, 2012 20:12
Show Gist options
  • Save rbrooks/2912371 to your computer and use it in GitHub Desktop.
Save rbrooks/2912371 to your computer and use it in GitHub Desktop.
Delete all but certain directories in current directory.
# Do the Find first, as a trial run.
find . -type d \( ! -iname "7604e960-3fc9-012f-2342-52540002105a" ! -iname "760660a0-3fc9-012f-2342-52540002105a" ! -iname "cac012a0-46b5-012f-1584-52540002105a" ! -iname "981fc740-8bf0-012f-2d2b-52540002105a" ! -iname "e268a4d0-95f6-012f-c815-52540002105a" \)
# Then do the actual delete.
find . -type d \( ! -iname "7604e960-3fc9-012f-2342-52540002105a" ! -iname "760660a0-3fc9-012f-2342-52540002105a" ! -iname "cac012a0-46b5-012f-1584-52540002105a" ! -iname "981fc740-8bf0-012f-2d2b-52540002105a" ! -iname "e268a4d0-95f6-012f-c815-52540002105a" ! -iname "a6e42e40-66fc-012f-f998-525400977599" \) -execdir rm -rfv {} +
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment