summaryrefslogtreecommitdiff
path: root/scripts/vyatta-image-tools.pl
diff options
context:
space:
mode:
authorJohn Southworth <john.southworth@vyatta.com>2011-04-28 10:41:52 -0500
committerJohn Southworth <john.southworth@vyatta.com>2011-04-28 10:41:52 -0500
commit8e6848f7b4190fb0a4890a6a177a5152c14592be (patch)
tree2a5b3ef59a85ebb5ebd1e5b45c5b59b4ef147ae1 /scripts/vyatta-image-tools.pl
parentfac678441717efbd2100a85cb3561ea1e513c3b8 (diff)
downloadvyatta-op-8e6848f7b4190fb0a4890a6a177a5152c14592be.tar.gz
vyatta-op-8e6848f7b4190fb0a4890a6a177a5152c14592be.zip
verify the users intention when deleting directories since we don't have a glob
Diffstat (limited to 'scripts/vyatta-image-tools.pl')
-rwxr-xr-xscripts/vyatta-image-tools.pl16
1 files changed, 13 insertions, 3 deletions
diff --git a/scripts/vyatta-image-tools.pl b/scripts/vyatta-image-tools.pl
index b343214..946d817 100755
--- a/scripts/vyatta-image-tools.pl
+++ b/scripts/vyatta-image-tools.pl
@@ -80,9 +80,19 @@ sub delete_file {
}
if (-d $file){
my $print_dir = conv_file_to_rel($topdir,$file);
- if (y_or_n("Do you want to erase the entire $print_dir directory?")){
- system("rm -rf $file");
- print("Directory erased\n");
+ print "This is a directory. Would you like to delete:\n"
+ ." Entire directory (D)\n"
+ ." Files in directory (F): ";
+ my $answer = <>;
+ if ($answer =~ /F|f/){
+ system("rm -rf $file/*");
+ } elsif ($answer =~ /D|d/){
+ if (y_or_n("Do you want to erase the entire $print_dir directory?")){
+ system("rm -rf $file");
+ print("Directory erased\n");
+ }
+ } else {
+ print "Unsupported operation\n";
}
} elsif (-f $file) {
my $print_file = conv_file_to_rel($topdir,$file);