2010-11-06

Perl one-liner: which directories do I need to restore?

I just ran an automatic process on a directory much higher up in the file system hierarchy than I wanted. Specifically, I accidentally did a Subversion Import on /Users from Xcode SCM dialog.

I can't just do a blanket restore starting at that top level directory. Specifically, Time Machine won't let me restore /Users. I quit Xcode shortly into the operation, and I need to know which subdirectories got hit so I can restore those.

How to do this? Do a find on which files were modified, then parse the output.

jbm@Foucault:~
$ sudo find /Users -mmin -15 -ls >/tmp/screwup.list 2>&1

jbm@Foucault:~
$ perl -ane '$p{join(" ", (split("/", $F[10]))[1..4])}++; END {for $i (keys %p) {print "$i\n";}}' /tmp/screwup.list 
Users jbm Library Preferences
Users jbm Library Application
Users jbm Code CoreDataTutorial
Users jbm Code MyApp
Users jbm Library Cookies
Users jbm Code Build
Users jbm Code SVN
Users jbm Library Caches
Users jbm Library Safari
Users jbm Code
Users jbm .DS_Store

No comments:

Post a Comment