interplane.Get Omega
Read in your language

sqlite

[Ported from github.com/sqlite/sqlite] Fix bugs in and improve the interface to the ".check" command of the CLI.

Brought by drakestapleton

branch master Branches Tags History

sqlite / tool / cp.tcl

28 lines · 783 bytes Raw Blame History
1#/usr/bin/tclsh
2#
3# This is a TCL script that copies multiple files into a common directory.
4# The "cp" command will do this on unix, but no such command is available
5# by default on Windows, so we have to use this script.
6#
7# tclsh cp.tcl FILE1 FILE2 ... FILEN DIR
8#
9
10# This should be as simple as
11#
12# file copy -force -- {*}$argv
13#
14# But jimtcl doesn't support that. So we have to do it the hard way.
15
16if {[llength $argv]<2} {
17 error "Usage: $argv0 SRC... DESTDIR"
18}
19set n [llength $argv]
20set destdir [lindex $argv [expr {$n-1}]]
21if {![file isdir $destdir]} {
22 error "$argv0: not a directory: \"$destdir\""
23}
24for {set i 0} {$i<$n-1} {incr i} {
25 set fn [file normalize [lindex $argv $i]]
26 set tail [file tail $fn]
27 file copy -force $fn [file normalize $destdir/$tail]
28}