Originally posted by Henry Bauer
## Purpose: Rename the files picked up and passed by tpsScanDir.tcl# and sent to tpsPgpSend. This script was created originally to# remove underscores in file names being sent to PGP for# encryption. The underscores are not allowed by PGP.# Author: Max Drown# Date: 05/02/2006# Args: tps keyedlist containing:# MODE run mode ("start" or "run")# MSGID message handle# Returns: list containing new file names#proc tpsRenameFiles { args } { global ibdir HciProcess keylget args MODE mode switch -exact -- $mode { start { echo "[whereAmI] Shutdown mode'" } run { keylget args MSGID mh set fileList [msgget $mh] set dispList "{CONTINUE $mh}" set newFileList {} puts "[whereAmI] Begin." foreach inFile $fileList { if {[regexp {tpsPgpSend} $inFile] == 0} { # Convert underscores to dashes puts "[whereAmI] Converting underscores to dashes in $inFile" regsub -all {_} $inFile {-} newFile #regsub {.} $newFile {-} newFile # Create a new list of files with the new file names lappend newFileList $newFile # Rename and move the file if {[catch {exec mv $ibdir/$inFile $ibdir/$newFile} catch_return]} { puts "[whereAmI] Error: Moving $inFile to $newFile failed: $catch_return" puts "[whereAmI] End." catch {exec hcienginestop -p $HciProcess > /dev/null &} catch_return return "" } else { puts "[whereAmI] Moved $inFile to $newFile (underscores converted to dashes)" } } else { # The file has already been renamed lappend newFileList $inFile } } puts "[whereAmI] DEBUG: newFileList= $newFileList" puts "[whereAmI] DEBUG: dispList= $dispList" puts "[whereAmI] End." msgset $mh "$newFileList" return $dispList } shutdown { echo "[whereAmI] Shutdown mode'" } default { echo "[whereAmI] Unknown mode: $mode" return "" } }}
set messageTs [clock format [clock seconds] -format %Y%m%d%H%M%S]
mv dump_011_idx_charges.post-processed CHGA`date +"%m%d%y"`.DAT
#!/usr/bin/ksh# this line to escape the next line from the tcl interpreter exec hcitcl "$0" "$@"# Begin Module Header ==============================================================================##------# Name:#------## file_mtime.tcl##---------# Purpose:#---------## Display to sdtout the mtime (last modification time) of the specified file# In the following format:## CCYY.MM.DD__HH.MM.SS##--------# Inputs:#--------# set name [lindex $argv 0] if {[cequal $name ""]} then {exit}##-------# Notes:#-------## Example of normal usage## file_mtime.tcl file_name_of_interest##---------# History:#---------## 2001.02.16 Russ Ross# - wrote initial version## End of Module Header =============================================================================set type [file type $name]if [cequal "$type" "file"] { set mtime [file mtime $name] puts stdout [fmtclock $mtime "%Y.%m.%d__%H.%M.%S"]}