webif/var/mongoose/cgi-bin/browse/mdelete.jim
hummypkg 84b5cb9506 reinstate delete, add failed recordings
git-svn-id: file:///root/webif/svn/humax/pkg/src/webif/trunk@638 2a923420-c742-0410-a762-8d5b09965624
2012-01-08 20:54:07 +00:00

49 lines
1.1 KiB
Plaintext
Executable File

#!/mod/bin/jimsh
package require cgi
source /mod/var/mongoose/lib/setup
require ts.class pretty_size
puts "Content-Type: text/html\r\n\r\n"
cgi_input 1
#cgi_dump
set dir [cgi_unquote_input [cgi_get dir]]
#puts "DIR: ($dir)"
puts "<div id=deleting class=blood><img src=/img/loading.gif>Deleting...</div>"
puts "<ul style=\"list-style-type: square\">"
foreach file [cgi_get files] {
set file [cgi_unquote_input $file]
puts -nonewline "<li>\"$file\"..."
if {![string match "$dir/*" $file]} {
puts "Error - outside directory."
continue
}
if {[file isdirectory $file]} {
puts -nonewline "Directory..."
puts [exec /mod/bin/busybox/rm -rf $file]
puts -nonewline "Done..."
} elseif {[string match {*.ts} $file]} {
set ts [ts fetch $file]
if {[catch {$ts delete} msg]} {
puts -nonewline "Error loading TS file..."
} else {
puts -nonewline "Done..."
}
} else {
if {[catch {file delete $file} msg]} {
puts -nonewline "Error: $msg"
} else {
catch {file delete "[file rootname $file].hmi"}
puts -nonewline "Done..."
}
}
puts "</li>"
}
puts "</ul>"