Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Aloha- moving datedsubs older than 45 days 1

Status
Not open for further replies.

FoeJilip

IS-IT--Management
Apr 2, 2015
13
0
0
US
Does anyone know of a feature or batch file that will take datedsubs older than 45days and compress and move them to another drive/location, etc. ?
 
You could probably find something on google and create a couple dummy folders in a location and play around with it until it works. I typically set Aloha to save dated subs for 999 days. Some people prefer to cut each years dated subs and paste them into a year folder within the bootdrv so they can easily move them back in for report purposes should they need to.
 
POStech, setting to 999 days is not a good idea either. Set setting to 0 and no purge folders. I have a small chain of restaurants that had the 999 as there setting. Now California Franchise tax board is doing audit of 4 and 5 years ago. Because a local dealer put in 999 he has no dated folders to reprint reports.

foeJilip are you concerned about disk space. Dated folders for 4 years would still be less than 5 gig worth of data.

If you are intent of moving, lookup Robocopy, it will do exactly what you are looking to do


AlohaRoss
3rd Party support
 
But how do you set for 45 days back.. and yes the idea is to just keep the AlohaQS folder tidy, we use NBO/Menulink for reporting and the point of record for most things, aloha records are just a backup just in case and local store reporting.

I was trying to build a batch file, i'm not that advance in it and google search didnt turn anything up. the variables for dated subs just don't fit sample batch files.

anyone out there do anything like this?
 
This is a bit dated, but should work in theory with a little bit of modification. It was used when this company backed up to a cd writer. You could, in theory, just have it move to another drive instead.


@ECHO OFF

:: This file will perform daily (EOD) backups, catchup backups (backing up
:: dated subs previously missed), and EDC backups. The EDC backup is
:: performed as part of the daily (EOD) backup process and is incremental,
:: meaning it creates only one EDC.zip file on %ArchDrv% and updates that
:: file with new/changed EDC files daily.

:: DISCLAIMER:
:: While this batch file has been tested and appears to work as expected,
:: no warranty is implied or given. Use freely, but USE AT YOUR OWN RISK.


:: *********************************************************************************
:: Setup Requirements: Ensure the IBERDIR variable is defined on the system, *
:: PKZIP.EXE resides in the system's path, and ARCHDRV is properly defined *
:: (in the first line of code below the usage instructions). *
:: *********************************************************************************


:: *********************************************************************************
:: Usage: *
:: -Call archive.bat without arguements for daily (EOD) backups *
:: -Call archive.bat with the "catchup" argument to backup missing historical *
:: dated subs (i.e. "d:\aloha\bin\archive.bat catchup" without the quotes) *
:: *
:: This file is intended to be called by Windows Scheduler Service, not Aloha. *
:: Schedule it to be launched daily anytime after EOD is performed. One exception *
:: may be a breakfast restaurant whose EOD is in the afternoon. For this batch *
:: file to pick up the dated sub properly, it should be scheduled to run *
:: sometime after midnight, because it assumes the dated sub is yesterday. *
:: *********************************************************************************



:: Set drive in which to archive the files to below:
SET ARCHDRV=C:

:: This section moves all dated sub zip files to folder C:\Aloha_Backups. /y trigger allows overwrite of files with the same name.
:: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
move /y "C:\20*.zip" "C:\Aloha_Backups"


:: This section gets dated sub to back up (assumes yesterday)
:: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SETLOCAL ENABLEEXTENSIONS

:: Get current date in YYYYMMDD format
FOR /f "tokens=1-4 delims=/-. " %%G IN ('date /t') DO (call :FIXDATE %%G %%H %%I %%J)
goto :GETDATE

:FIXDATE
if "%1:~0,1%" GTR "9" shift
FOR /f "skip=1 tokens=2-4 delims=(-)" %%G IN ('echo.^|date') DO (
set %%G=%1&set %%H=%2&set %%I=%3)
goto :EOF

:GETDATE
:: Convert to Modified Julian date
if 1%yy% LSS 200 if 1%yy% LSS 170 (set yy=20%yy%) else (set yy=19%yy%)
set /a dd=100%dd%%%100,mm=100%mm%%%100
set /a z=14-mm,z/=12,y=yy+4800-z,m=mm+12*z-3,j=153*m+2
set /a j=j/5+dd+y*365+y/4-y/100+y/400-2432046
set MJD=%j%

:: Subtract a day
set /a MJD=%MJD% - 1

:: Convert back to YYYYMMDD format
set /a a=%MJD%+2432045,b=4*a+3,b/=146097,c=-b*146097,c/=4,c+=a
set /a d=4*c+3,d/=1461,e=-1461*d,e/=4,e+=c,m=5*e+2,m/=153,dd=153*m+2,dd/=5
set /a dd=-dd+e+1,mm=-m/10,mm*=12,mm+=m+3,yy=b*100+d-4800+m/10
(if %mm% LSS 10 set mm=0%mm%)&(if %dd% LSS 10 set dd=0%dd%)
endlocal&set datedsub=%yy%%mm%%dd%&set y=%yy%&set m=%mm%&set d=%dd%



:: Check if running in Catch-Up mode
IF /I "%1"=="catchup" GOTO ALL


:DAILY
:: This section is EOD backup - yesterday only
:: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:: Check for existence of prior archive
IF EXIST %ARCHDRV%\%datedsub%.ZIP GOTO END

:: Delete *.CDX files from dated folder
DEL %IBERDIR%\%datedsub%\*.CDX

:: Zip the dated folder to the archive location
PKZIP.EXE %ARCHDRV%\%datedsub%.ZIP %IBERDIR%\%datedsub%\*.*

:: Backup all new/changed EDC files (incremental)
PKZIP.EXE -i -rp %ARCHDRV%\EDC.ZIP %IBERDIR%\EDC\*.*

:: Verify successful dated folder and EDC archive
IF NOT EXIST %ARCHDRV%\%datedsub%.ZIP GOTO FAILURE
IF NOT EXIST %ARCHDRV%\EDC.ZIP GOTO FAILURE
GOTO END


:ALL
:: This section is catchup backups - all dated subs
:: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:CYCLE
:: Check for existence of dated sub to back up
IF NOT EXIST %IBERDIR%\%datedsub% GOTO END

:: Check for existence of prior archive
IF EXIST %ARCHDRV%\%datedsub%.ZIP GOTO HISTORY

:: Dated sub not yet archived, start backup process
:: Delete *.CDX files from dated folder
DEL %IBERDIR%\%datedsub%\*.CDX

:: Zip the dated folder to the archive location
PKZIP.EXE %ARCHDRV%\%datedsub%.ZIP %IBERDIR%\%datedsub%\*.*

:: Verify successful dated folder archive
IF EXIST %ARCHDRV%\%datedsub%.ZIP GOTO HISTORY
GOTO FAILURE


:HISTORY
:: This section goes back one more day each time thru...
:: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
SETLOCAL ENABLEEXTENSIONS
set yy=%y%&set mm=%m%&set dd=%d%
:: Convert to Modified Julian date
if 1%yy% LSS 200 if 1%yy% LSS 170 (set yy=20%yy%) else (set yy=19%yy%)
set /a dd=100%dd%%%100,mm=100%mm%%%100
set /a z=14-mm,z/=12,y=yy+4800-z,m=mm+12*z-3,j=153*m+2
set /a j=j/5+dd+y*365+y/4-y/100+y/400-2432046
set MJD=%j%

:: Subtract a day
set /a MJD=%MJD% - 1

:: Convert back to YYYYMMDD format
set /a a=%MJD%+2432045,b=4*a+3,b/=146097,c=-b*146097,c/=4,c+=a
set /a d=4*c+3,d/=1461,e=-1461*d,e/=4,e+=c,m=5*e+2,m/=153,dd=153*m+2,dd/=5
set /a dd=-dd+e+1,mm=-m/10,mm*=12,mm+=m+3,yy=b*100+d-4800+m/10
(if %mm% LSS 10 set mm=0%mm%)&(if %dd% LSS 10 set dd=0%dd%)
endlocal&set datedsub=%yy%%mm%%dd%&set y=%yy%&set m=%mm%&set d=%dd%
GOTO CYCLE


:FAILURE
:: Failure Message
:: ~~~~~~~~~~~~~~~
Echo. > %IBERDIR%\TMP\ArchErr.TXT
Echo. >> %IBERDIR%\TMP\ArchErr.TXT
Echo ******************************************* >> %IBERDIR%\TMP\ArchErr.TXT
Echo ***WARNING*** ***WARNING*** >> %IBERDIR%\TMP\ArchErr.TXT
Echo ******************************************* >> %IBERDIR%\TMP\ArchErr.TXT
Echo. >> %IBERDIR%\TMP\ArchErr.TXT
Echo. >> %IBERDIR%\TMP\ArchErr.TXT
Echo *** THIS IS VERY IMPORTANT! *** >> %IBERDIR%\TMP\ArchErr.TXT
Echo *** DO NOT IGNORE THIS MESSAGE! *** >> %IBERDIR%\TMP\ArchErr.TXT
Echo. >> %IBERDIR%\TMP\ArchErr.TXT
Echo. >> %IBERDIR%\TMP\ArchErr.TXT
Echo There was an error while creating the >> %IBERDIR%\TMP\ArchErr.TXT
Echo backup for %datedsub% date of business. >> %IBERDIR%\TMP\ArchErr.TXT
Echo. >> %IBERDIR%\TMP\ArchErr.TXT
Echo The most likely cause is that the >> %IBERDIR%\TMP\ArchErr.TXT
Echo CD is not in the CD writer or the >> %IBERDIR%\TMP\ArchErr.TXT
Echo CD in the CD writer is full. >> %IBERDIR%\TMP\ArchErr.TXT
Echo. >> %IBERDIR%\TMP\ArchErr.TXT
Echo. >> %IBERDIR%\TMP\ArchErr.TXT
Echo Check the CD status, insert and format >> %IBERDIR%\TMP\ArchErr.TXT
Echo a new CD using Roxio DirectCD Format >> %IBERDIR%\TMP\ArchErr.TXT
Echo Utility, found in Start/Programs/Roxio >> %IBERDIR%\TMP\ArchErr.TXT
Echo Easy CD Creator 5, if required. >> %IBERDIR%\TMP\ArchErr.TXT
Echo. >> %IBERDIR%\TMP\ArchErr.TXT
Echo. >> %IBERDIR%\TMP\ArchErr.TXT
Echo. >> %IBERDIR%\TMP\ArchErr.TXT


GOTO END
Exit

:END







 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top