Hi, I am in need of help to name a file using a timestamp naming convention. I have two examples listed. Example #2 names the file like I want, however Example #1 is the script I need to use.
Can some explain how to modify Example #1 to include the TIME onto the name of the capture file???
Thanks in advance for any assistance!
*********************************************************
EXAMPLE #1
string szRepDate, szTodaysDate, szTimeString, szThisYear, szThisMonth
string szThisDay, szDestPrimary, szDestBackup
string szTempFile = szTempCapDir
strcat szTempFile "temp.txt"
ltimestrs $ltime szTodaysDate szTimeString ;Convert date to xx/xx/xx
strextract szThisMonth szTodaysDate "/" 0 ;Extract the month for the name.
strextract szThisDay szTodaysDate "/" 1 ;Extract the day for the name.
strextract szThisYear szTodaysDate "/" 2 ;Extract the year for the name.
strfmt szThisMonth "%02.2s" szThisMonth ;Format the Month part of name.
strfmt szThisDay "%02.2s" szThisDay ;Format the Day part of name.
strfmt szRepDate "%s%s%s.txt" szThisMonth szThisDay szThisYear
;Set the capture file name
;Using MMDDYY.txt format
strfmt szDestPrimary "%s%s" szPrimaryDirectory szRepDate
strfmt szDestBackup "%s%s" szBackupDirectory szRepDate
if copyfile szTempFile szDestPrimary ;Copy the report to primary location.
else
copyfile szTempFile szDestBackup ;Copy the file to backup location if.
;the primary is not available.
endif
**********************************************************
EXAMPLE #2
string sCapPath, sCapFile, sCapFile2, sNewFile
integer iDay, iMonth
integer iYear, iHour
integer iMin, iSec
ltimeints $LTIME iYear iMonth iDay iHour iMin iSec
strfmt sNewFile "%s%d%02d%02d%s%02d%02d%02d" "ACD_" iYear iMonth iDay "_" iHour iMin iSec
strcat sNewfile ".TXT"
strfmt sCapFile "%s\temp.txt" sCapPath
strfmt sCapFile2 "%s\%s" sCapPath sNewFile
shortpath sCapFile sCapFile
rename sCapFile sCapFile2
;usermsg sNewfile
Can some explain how to modify Example #1 to include the TIME onto the name of the capture file???
Thanks in advance for any assistance!
*********************************************************
EXAMPLE #1
string szRepDate, szTodaysDate, szTimeString, szThisYear, szThisMonth
string szThisDay, szDestPrimary, szDestBackup
string szTempFile = szTempCapDir
strcat szTempFile "temp.txt"
ltimestrs $ltime szTodaysDate szTimeString ;Convert date to xx/xx/xx
strextract szThisMonth szTodaysDate "/" 0 ;Extract the month for the name.
strextract szThisDay szTodaysDate "/" 1 ;Extract the day for the name.
strextract szThisYear szTodaysDate "/" 2 ;Extract the year for the name.
strfmt szThisMonth "%02.2s" szThisMonth ;Format the Month part of name.
strfmt szThisDay "%02.2s" szThisDay ;Format the Day part of name.
strfmt szRepDate "%s%s%s.txt" szThisMonth szThisDay szThisYear
;Set the capture file name
;Using MMDDYY.txt format
strfmt szDestPrimary "%s%s" szPrimaryDirectory szRepDate
strfmt szDestBackup "%s%s" szBackupDirectory szRepDate
if copyfile szTempFile szDestPrimary ;Copy the report to primary location.
else
copyfile szTempFile szDestBackup ;Copy the file to backup location if.
;the primary is not available.
endif
**********************************************************
EXAMPLE #2
string sCapPath, sCapFile, sCapFile2, sNewFile
integer iDay, iMonth
integer iYear, iHour
integer iMin, iSec
ltimeints $LTIME iYear iMonth iDay iHour iMin iSec
strfmt sNewFile "%s%d%02d%02d%s%02d%02d%02d" "ACD_" iYear iMonth iDay "_" iHour iMin iSec
strcat sNewfile ".TXT"
strfmt sCapFile "%s\temp.txt" sCapPath
strfmt sCapFile2 "%s\%s" sCapPath sNewFile
shortpath sCapFile sCapFile
rename sCapFile sCapFile2
;usermsg sNewfile