Move Output Files to Directory using Script Monitor in 5.0

All things related to the Script feature of AccuZIP6, including the Script Monitor.

Moderators: Chrissy, Steve, Terry, Donna, Dave, Eric, MartyH, Kristen, Geoff, Vince

Post Reply
Kristen
Moderator
Posts: 726
Joined: Wed Sep 20, 2006 3:46 pm

Move Output Files to Directory using Script Monitor in 5.0

Post by Kristen » Fri Sep 14, 2007 11:53 am

This command will move the Output file and the associated PDF reports from the "In" directory to a subfolder in the specified "Out" directory with the subfolder being the same name as the database and Date and Time Stamped. This command will also Archive all Input files into a Date and Time Stamped folder in the c:\working\archives directory. This command can be used as the last even in a Script using the Script Monitor feature in AccuZIP6 5.0. Make sure to edit the script's Input and Output Paths to Match your own:

Command Statement Syntax:
PUBLIC com_InputFilePath,com_outputFolder,com_InputFileGen,com_ArchiveFolder,com_Error,com_DateTime,com_copyFolder,com_InputFileGenpdf
* Turn messages
SET SAFETY OFF
* Turn off any errors
ON ERROR com_Error=MESSAGE()
* Get input file path
com_InputFilePath=FILETOSTR("Cleanup.ini")
* Get all files with same name as input path
com_InputFileGen=IIF(FILE(com_InputFilePath),FORCEEXT(com_InputFilePath,"*"),"")
com_InputFileGenpdf=IIF(FILE(com_InputFilePath),FORCEEXT(com_InputFilePath,"*"),"")
* Create DateTime Stamp
com_DateTime=ALLTRIM(STR(YEAR(DATE())))+"-"+;
PADL(ALLTRIM(STR(MONTH(DATE()))),2,"0")+"-"+;
PADL(ALLTRIM(STR(DAY(DATE()))),2,"0")+" "+ALLTRIM(SYS(2))
*Create output location
com_outputFolder="c:\OutputCASS"

* Create copy Folder Name
com_copyFolder="c:\OutputCASS\"+FORCEEXT(JUSTFNAME(com_InputFilePath),"")+" "+com_DateTime
MKDIR(com_copyFolder)

* Copy all input files and related files to Output folder Folder
COPY TO (ADDBS(com_copyFolder)+FORCEEXT(JUSTFNAME(com_InputFilePath),"dbf"))
COPY FILE "c:\InputCASS\*.pdf" TO (ADDBS(com_copyFolder)+"*")
delete file "c:\InputCASS\*.pdf"

* Create Archive Folder Name
com_ArchiveFolder="C:\Working\Archives\"+FORCEEXT(JUSTFNAME(com_InputFilePath),"")+" "+com_DateTime
* Create Archive Folder
MKDIR(com_ArchiveFolder)
* Close all databases
CLOSE DATABASES
* Copy all input files and related files to Archive Folder
COPY FILE (com_InputFileGen) TO (ADDBS(com_ArchiveFolder)+"*")
* Delete input files
DELETE FILE(com_InputFileGen)
* Delete cleanup.ini that holds input path
DELETE FILE(com_InputFilePath)

Post Reply