From 2124f07354cd4e237acb129c536ec8af53b8cbd8 Mon Sep 17 00:00:00 2001 From: Chris Koeritz Date: Fri, 8 Nov 2013 03:07:23 -0500 Subject: [PATCH] much cleanly, temporarily hiding the ability to whack junk dirs, but the bug that made that go hidden is fixed. --- scripts/files/filename_helper.pl | 11 +++++++++-- scripts/files/zap_the_dir.pl | 6 ++++-- scripts/files/zapdirs.pl | 2 +- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/scripts/files/filename_helper.pl b/scripts/files/filename_helper.pl index 9b8668c2..318e5829 100644 --- a/scripts/files/filename_helper.pl +++ b/scripts/files/filename_helper.pl @@ -333,7 +333,7 @@ sub important_filename { "\\.sbr", ".*scc", "^Setup\\.dbg", "^Setup\\.inx", "^Setup\\.map", "^Setup\\.obs", "^Selenium_.*Login.html", "\\.stackdump", "^string1033\\.txt", "\\.suo", "\\.swp", - "^thumbs.db", "\\.tmp", "^trans\\.tbl", "\\.user", "_version\\.h", + "^thumbs.db", "[a-zA-Z0-9]\\.tmp", "^trans\\.tbl", "\\.user", "_version\\.h", "_version\\.rc", "^waste", "\\.ws4", "\\.wsm"); foreach $temp (@junk_files) { @@ -394,9 +394,16 @@ sub upper { # recursively deletes a directory that is passed as the single parameter. # from http://developer.novell.com/wiki/index.php/Recursive_Directory_Remove sub recursive_delete { + +#hmmm: this should iterate across all params. my $dir = shift; - local *DIR; + if ( -f "$dir" ) { +print "this is not a dir: $dir\nshould whack it here?\n"; +return; + } + + local *DIR; opendir DIR, $dir or die "opendir $dir: $!"; my $found = 0; while ($_ = readdir DIR) { diff --git a/scripts/files/zap_the_dir.pl b/scripts/files/zap_the_dir.pl index 6d0b6212..04983850 100644 --- a/scripts/files/zap_the_dir.pl +++ b/scripts/files/zap_the_dir.pl @@ -42,9 +42,11 @@ sub remove_whackables { $fname = $from_dir . '/' . $fname; #print "whacking: $fname.\n"; unlink $fname; - if (-d "$fname") { - print "recursively deleting directory: $fname\n"; + if (-f "$fname") { + print "cleaning file: $fname\n"; &recursive_delete($fname); + } else { + print "not touching unimportant dir right now: $fname\n"; } } } diff --git a/scripts/files/zapdirs.pl b/scripts/files/zapdirs.pl index d69da8a0..16a5e0ab 100644 --- a/scripts/files/zapdirs.pl +++ b/scripts/files/zapdirs.pl @@ -47,7 +47,7 @@ if ($#ARGV < 0) { } } -#print "zap list is:\n@to_zap\n"; +print "zap list is:\n@to_zap\n"; &recursively_zap_dirs(@to_zap); -- 2.34.1