#=================================================================================
$DaDate = Get-Date
$fd_Date=$DaDate.ToString('yyyy-MM-dd')
$LLogDate = $fd_Date.Replace("-","_") #
$FileDate = $fd_Date.Replace("-","") #
$printDate = $fd_Date
#
$SrcPath =Split-Path -Parent $MyInvocation.MyCommand.Definition;
$SrcPath
cd $SrcPath
#set desPath defalult by current folder
$DesPath = $SrcPath
$ExportPath="$SrcPath\Export_BOM_"+"$FileDate"
$bIsSrcExit = Test-Path($ExportPath)
if(-not $bIsSrcExit)
{
mkdir $ExportPath
}
#[1] export db files
cp $DesPath\Data\ScData\*.db $ExportPath
#[2] export log files
#cp $DesPath\Log\*$LLogDate*.log $ExportPath
cp -Recurse $DesPath\Data\Log\ $ExportPath
#[3] export print files
# $bIsDirExit = Test-Path("$ExportPath\PrintFile")
# if(-not $bIsDirExit){
# mkdir "$ExportPath\PrintFile"
# # cp $DesPath\ScData\PrintFile\$printDate\*.ptn $ExportPath\PrintFile\
# cp -Recurse $DesPath\ScData\PrintFile\ $ExportPath\PrintFile\
# }
cp -Recurse $DesPath\Data\ScData\PrintFile\ $ExportPath\
#[4] export tpu driver log
cp -Recurse $DesPath\CardDriverLog $ExportPath\
#=================================================================================
$filezip = "Export_" +$FileDate + ".zip"
Compress-Archive -Update $ExportPath $filezip
rm -Force -Recurse $ExportPath
# pause