[AccessD] One Accdr (front end) for each User's PC or Share theAccdr file on the File Server

James Button jamesbutton at blueyonder.co.uk
Wed Oct 22 07:22:38 CDT 2014


If you want you can use a .cmd file to check a date/time held within a text file


The following is an extract from a script I use to create a backup of whatever
files have 'changed' as denoted by a  file date/timestamp greater than the last
time the backup ran - with the pfile.log holding the run date/time in the form
01/01/1900-23:08:58.78
Note the wodge of code at the start and the echo at the end to post the new
date-time.

The script was originally using the windows supplied xcopy, and then came to use
robocopy - with the tee.exe to dual the output to screen and a logfile
Some of those using the facility are not allowed to install new software - hence
the windows facilities and tee.exe that is nice, but not essential.

Oh! and the script should, ideally use a zip process for the files to avoid
too-long filenames in the backup, but KISS applied.
 
JimB
-------------------
Echo off
set
btimest=%date:~6,4%-%date:~3,2%-%date:~0,2%.%time:~0,2%.%time:~3,2%.%time:~6,2%

for /F        "delims=/-: tokens=1,2,3"  %%H in (pfile.log) do (
set bdatest=%%I-%%H-%%J 
set bdaterc=%%J%%I%%H 
)

Echo   %btimest% %bdatest% >nul:
Echo  btimest (%btimest%) is the datetime entry for the folder >nul:
Echo  bdatest (%bdatest%) is the date of the prior run from the logfile >nul:

Echo  So - make and goto new folder "backup on %btimest%" and xcopy with \date
%bdatest%>nul:
Echo  Then post param btimest (%btimest%) into the log file  >nul:
Echo  If not before date ask about overwrite  /c /f /h /s /-y    /d:%bdatest%
>nul:


Echo This script is about to copy files updated on, or after %bdatest% into a
folder named  "%USERNAME% on  %btimest%" on this partition (drive)
Pause 

Echo  in the following commands    >nul:
Echo              .\ means the current folder and  bdatest  is the earliest date
(mm-dd-yyyy) of files to be copied                           >nul:
Echo              HOMEDRIVE and HOMEPATH point to the system variables for the
users 'personal' storage area                >nul:
Echo              Note the use above of USERNAME within the folder name to hold
this users set of backups                              >nul:
Echo      - for Robocopy options enter command ROBOCOPY /?
>nul:
Echo              Robocopy /256 option not used so system should copy files with
long names - accessing them is your problem   >nul:
Echo              Robocopy  /MON:10 option not used - it would rerun the copy if
more than 10 files in the folder change again   >nul:
Echo              Robocopy  /MOT:10 option not used - it would rerun the copy in
10 mins if any files in the folder change again  >nul:
Echo              Robocopy  /MAXAGE:yyyymmdd  is the equivalent to xcopy
/d:mm-dd-yyyy                                                         >nul:
Echo              Robocopy  /R:3 and  /W:2  set retries  limited to 3 with 2
second wait - Don't expect user to close an open file   >nul:
Echo              Robocopy  /XJ options set to avoid copying files via their
'JUNCTION-NAME'                                                   >nul:
Echo              Robocopy  /FP /TS /NP logging options set to list fullnamename
and timestamp of copied files                            >nul:
Echo              Robocopy /TEE and /LOG+:robocopyactivity.log set so actions
will be displayed and added to the named file     >nul:


Echo  on
cd     "\backup of c"
mkdir  "%USERNAME% on %btimest%"
cd     "%USERNAME% on %btimest%"

rem Robocopy   "%HOMEDRIVE%%HOMEPATH%\My Documents"
".\%COMPUTERNAME%%HOMEPATH%\My Documents" *.* /S /ZB /COPY:DAT    /R:3 /W:2
/FP /TS /NP /TEE /LOG+:robocopyactivity.log /MAXAGE:%bdaterc%

xcopy   "%HOMEDRIVE%\My Documents\*.*"            ".\%COMPUTERNAME%\My
Documents\"   /c /f /h /s /-y     /d:%bdatest%

xcopy   "%HOMEDRIVE%%HOMEPATH%\Desktop\*.*"
".\%COMPUTERNAME%\%HOMEPATH%\Desktop\"   /c /f /h /s /-y     /d:%bdatest%

Pause Please check the summary, and data files listed above include all that you
expect

dir /s
cd \

echo %date%-%Time% >pfile.log

Pause Please check the data files (listed above) as now being in the new folder
include all that you expect


    
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Stuart McLachlan
Sent: Wednesday, October 22, 2014 1:47 AM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] One Accdr (front end) for each User's PC or Share
theAccdr file on the File Server

Ah-ha! So you're using scriptiing, not just a simple cmd/bat file.

-- 
Stuart

On 21 Oct 2014 at 23:24, Darryl Collins wrote:

> Here is the snippet of code that does the read / copy bit if you are
> interested.
> 
> ' Read the version text files and compare them.
> if FS.fileexists(destinationPath & "version.txt") then
>  destTxtVersionFile = GetFile(destinationPath & "version.txt")
>  sourceTxtVersionFile = GetFile(sourcePath & "version.txt")
>  copyTheFile = not (destTxtVersionFile = sourceTxtVersionFile)
> else
>  copyTheFile = true
> end if
> 
> if (FS.fileexists(destinationPath & applicationname & ".accde") =
> false) then copyTheFile = true	
> 
> if copyTheFile then
>  FS.CopyFile sourcePath & applicationName & ".accde", destinationPath
>  FS.CopyFile sourcePath & "version.txt", destinationPath
>  FS.CopyFile sourcePath & "Icon.ico", destinationPath
>  copyOtherSpecifiedFiles
> end if
> 
> 
> 
> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com
> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Stuart
> McLachlan Sent: Wednesday, 22 October 2014 9:54 AM To: Access
> Developers discussion and problem solving Subject: Re: [AccessD] One
> Accdr (front end) for each User's PC or Share theAccdr file on the
> File Server
> 
> Incidentally, you don't actually need to "read" the two files to
> compare them.
> 
> The simplest way is something like:
> 
> FC AppVersion.txt \\server\database\AppVersion.txt > nul IF errorlevel
> 1 COPY....
> 
> 



More information about the AccessD mailing list