+# exec_rmdir()
+#
+# Remove a directory and return to directory view
+#
+# Params: 1. Reference to user input hash
+# 2. Reference to config hash
+#
+# Return: Output of the command (Scalar Reference)
+
+sub exec_rmdir($$)
+{
+ my ($data,$config) = @_;
+ my $physical = $data->{'physical'};
+ my $virtual = $data->{'virtual'};
+
+ return exec_remove($data,$config) if(not -d $physical);
+
+ if($data->{'cgi'}->param('confirmed'))
+ {
+ rmtree($physical);
+ return devedit_reload({command => 'show', file => upper_path($virtual)});
+ }
+ else
+ {
+ my $dir = encode_entities(upper_path($virtual));
+ my $output;
+
+ $output = htmlhead("Remove directory $virtual");
+ $output .= equal_url($config->{'httproot'},$virtual);
+
+ $virtual = encode_entities($virtual);
+
+ $output .= dir_link($virtual);
+
+ $output .= <<"END";
+<p>Do you really want to remove the directory '$virtual' and all of it's files and sub directories?</p>
+
+<form action="$script" method="get">
+<input type="hidden" name="command" value="rmdir">
+<input type="hidden" name="file" value="$virtual">
+<input type="hidden" name="confirmed" value="1">
+
+<p><input type="submit" value="Yes"></p>
+</form>
+
+<form action="$script" method="get">
+<input type="hidden" name="command" value="show">
+<input type="hidden" name="file" value="$dir">
+
+<p><input type="submit" value="No"></p>
+</form>
+END
+
+ $output .= htmlfoot;
+
+ return \$output;
+ }