wp_numeric_sort_bulk_slides

one of the documented procedures in this installation of the ACS
Usage:
wp_numeric_sort_bulk_slides   { file_list "" }
What it does:
Sort bulk-imported slides numerically (instead of using ascii sort)
Defined in: /web/philip/tcl/wp-defs.tcl

Source code:



    # auxiliary sort proc
    proc wp_integer_sort {file1 file2} {
	set file1_base [file tail $file1]
	set file2_base [file tail $file2]
	# extract filenumbers from filenames
	regexp -nocase {([0-9]+).*\.} $file1_base match number1
	regexp -nocase {([0-9]+).*\.} $file2_base match number2
	return [expr $number1 - $number2]
    }

    # check that all filenames have a number somewhere
    set file_number_p "t"
    foreach image $file_list {
	set image_base [file tail $image]
	if {![regexp -nocase {([0-9]+).*\.} $image_base match slide_number]} {
	    set file_number_p "f"
	    break
	}
    }

    # if all files match the format, sort file list
    if {$file_number_p == "t"} {
	return [lsort -command wp_integer_sort $file_list]
    } else {
	return $file_list
    }


philg@mit.edu