1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Solved: Automated date script

Discussion in 'Software Development' started by usmc-ratman, Aug 31, 2004.

Thread Status:
Not open for further replies.
Advertisement
  1. usmc-ratman

    usmc-ratman Thread Starter

    Joined:
    Aug 6, 2004
    Messages:
    140
    System: WinXP and Win98SE

    I need help with a script or vbcode that will automatically backup a file or files daily. The current format (so that I can identify the date it was backed up) is: date-filename.bak (ie. 040831-filename.bak).

    I would prefer the date be generated automatically, but if there is a dialog box that appears so that the user enters the date manually, that would be fine also.

    This particular need is going to be used as an intermediate step to the weekly backups of the datafiles, and is not intended to take the place of the full backup procedure. But I need a step in there incase the the file becomes corrupt, and the user does not know it until several days later, they can go back one or two days, not an entire week, to use as a starting point on the data.

    Any help would be greatly appreciated.
    Thank you.
     
  2. Mosaic1

    Mosaic1

    Joined:
    Aug 17, 2001
    Messages:
    7,486
    Are these files all in the same Folder? Another idea would be to create a new folder and name it as the date and time + Backup. The system can get the time and date easily. That's not a problem.

    Then copy the current files into that folder and preface the filename with Backup or not. Did you want to create a log of the files and their original locations in the folder too?

    Do you have any code already started? If so, please post it.
     
  3. Rockn

    Rockn

    Joined:
    Jul 29, 2001
    Messages:
    21,334
    Dim strFileName, nDate
    nDate= Replace(Date(),"/", "")
    strFilename = Cstr(nDate) & ".bak"

    This will generate a date formatted named backup. It almost looks like you are trying to rename the files instead of doing an actual backup.
     
  4. usmc-ratman

    usmc-ratman Thread Starter

    Joined:
    Aug 6, 2004
    Messages:
    140
    A1: The files are in the same folder, specifically there are two files that need to be done daily. Having it create a folder named as the date, and then copying the two files into that folder would probably work great. I'd be more than satified with that. The time stamp is really not necessary either. And since each date a new folder was created, it probably would not be necessary to rename the file name or extention.
    A2: No log is necessary.
    A3: Don't have any code, don't really know much about it (i.e. illiterate).


    To Rockn -- Thanks for code snippet and your input, but because I'm new to coding/programming I don't have a clue what to do with it, or how to execute it. I appreciate it though. (y)
     
  5. Fredledingue

    Fredledingue

    Joined:
    Aug 22, 2003
    Messages:
    378
    What about...

    If 12:00:00 = Time Then
    script to backup the files
    End If

    Everyday at 12'o clock it will perform the back up.

    BackUpFileName = "MyBackUp" & Replace(Date, "/", "") & ".zip" (or ".bak")
     
  6. Fredledingue

    Fredledingue

    Joined:
    Aug 22, 2003
    Messages:
    378
    I took this script for some VBS website. I didn't use it yet. you can have a look:

    Backup Files (copy) With Logging Version 2... ( Vbscript )





    Author: Tom Hingston

    Description:
    This script backs up (copies) folders or files to a preset backup location and logs that last 5 backup files. This is an improvement on an earlier script I submitted that only copied folder (not files).

    Script:

    'Tom's Cool Backup Script 16 JAN 2001
    'Written by Tom Hingston of http://cheqsoft.com
    '
    'This script copies all the files that are new or have changed,
    'to the backup folder specified by BackupPath.
    'It also logs the files copied from the last 5 backups to C:\Backuplog.txt
    '
    'INSTRUCTIONS
    'You need to change settings in 2 places below... Setting 1 is where to
    'backup to; Setting 2 is what to backup. There is optional Setting 3 which
    'allows you to exclude some sub-folders from within the folders being backed up.
    '
    'All file/folder paths need to be inside speech marks "Like this"
    'or otherwise the speech marks need to be empty ""
    '
    ' Learn about VBScript at...
    ' http://msdn.microsoft.com/scripting/default.htm?/scripting/vbscript/
    '====================


    '====================
    'SETTING 1 - WHERE TO BACKUP TO...
    ' Set BackupPath
    ' BackupPath is the Folder that you want to backup to....
    ' Example1: BackupPath = "H:\Backup"
    ' Example2: BackupPath = "\\Tom\C\Quality Documents"

    BackupPath = "Z:\Backup" ' <-- Set backup path here

    'END OF SETTING 1
    '====================


    If Wscript.Arguments.Count = 0 Then 'not initiated by dropping folder on it


    '====================
    'SETTING 2 - FILES AND/OR FOLDERS TO BACKUP...
    '
    'These are the Files and/or Folders that you want to backup.

    Quantity = 20 '<-- This can be increased if MyData(?) increases.
    redim MyData(Quantity)

    ' These are the Folders that you want to backup...
    ' EXAMPLE: MyData(1) = "C:\Data"

    MyData(1) = "C:\Documents and Settings\Administrator\Application Data\Microsoft\Outlook Express" '<-- Set these
    MyData(2) = "E:\Tom"
    MyData(3) = "C:\clpbdexp.ini"
    MyData(4) = "E:\Pics"
    MyData(5) = "C:\Documents and Settings\Administrator\Favorites"
    MyData(6) = "C:\Documents and Settings\Administrator\Application Data\Microsoft\Address Book"
    MyData(7) = "E:\Misc"
    MyData(8) = "D:\Program Files\PADGen\Chequers_Software"
    MyData(9) = "D:\Program Files\MusicMatch\MusicMatch Jukebox\Playlist"
    MyData(10) = "C:\Documents and Settings\Administrator\Application Data\GlobalSCAPE\CuteFTP\sm.dat"
    MyData(11) = ""
    MyData(12) = "F:\CatBackup"
    MyData(13) = "D:\Program Files\Setup Generator Pro\Projects"
    MyData(14) = "E:\Catrina"
    MyData(15) = "C:\Documents and Settings\Administrator\Application Data\MailWasher\Blacklist.txt"
    MyData(16) = "C:\Documents and Settings\Administrator\Application Data\MailWasher\Filters.txt"
    MyData(17) = "D:\Program Files\ICQ\2000b"
    MyData(18) = ""
    MyData(19) = ""
    MyData(20) = ""


    'END OF SETTING 2
    '====================


    Else
    redim MyData(1)
    MyData(1) = Wscript.Arguments(0) 'was initiated by dropping folder on it
    Quantity = 1
    End If


    '====================
    'SETTING 3 - FOLDERS TO EXCLUDE... (optional)
    '
    'These are Sub-Folders within the folders being backed up,
    'that you can Exclude from the backup.
    'EXAMPLE: Excl_Data(1) = "C:\Data\Kids files"

    Excl_Quantity = 5 '<-- This can be increased if Excl_Data(?) increases.
    redim Excl_Data(Excl_Quantity)

    Excl_Data(1) = "" '<-- Set these if required
    Excl_Data(2) = ""
    Excl_Data(3) = ""
    Excl_Data(4) = ""
    Excl_Data(5) = ""

    'END OF SETTING 3
    '====================


    set fso = CreateObject("Scripting.FileSystemObject")


    strScript = WScript.ScriptFullName
    strScript = fso.GetFileName( strScript )
    strScript = left( strScript, len(strScript) - 4 )

    StartMe = msgbox("Welcome to Tom's Cool Backup script." & vbcrlf & vbcrlf & _
    "Backing up to " & BackupPath & " (" & strScript & ")" & vbcrlf & vbcrlf & _
    "Would you like to start your backup now ?" , 33, "Tom's Cool Backup Script " & " - " & strScript )
    if StartMe = 2 then 'cancelled
    wscript.quit
    End if


    count = 0
    dim arrResults ' array to store results in
    redim arrResults(0)


    If right(BackupPath, 1) <> "\" then
    BackupPath = BackupPath & "\" 'inserts the slash as it is required later
    End If

    call CheckPath

    if not fso.folderExists ( BackupPath ) then
    fso.CreateFolder( BackupPath )
    end if


    'sets drv for MakeFolderPath
    If left(BackupPath , 1) = "\" then 'network
    for ss = 1 to len(BackupPath )
    strCh = mid(BackupPath , ss, 1)
    if strCh = "\" then countslash = countslash + 1
    if countslash = 3 then
    drv = ss + 3
    end if
    next 'ss
    if not countslash >= 3 then msgbox "Error in script relative to network path"
    else 'local drive letter
    drv = 5
    End If

    For i = 1 to Quantity
    If MyData(i) <> "" then

    if fso.DriveExists( MyData(i) ) Then 'it is a drive
    call backup( MyData(i) )

    elseif fso.folderExists(MyData(i)) then 'it is a folder
    call MakeFolderPath( BackupPath & right(MyData(i), len(MyData(i))-3 ) )
    call backup( MyData(i) )

    elseif fso.fileExists(MyData(i)) then 'it is a file
    call FileBackup( MyData(i) )

    else 'not a drive or folder or file
    msgbox MyData(i) & vbcrlf & vbcrlf & "This file/folder does not appear to exist" & _
    vbcrlf & "Please ensure you have typed it correctly or that" & vbcrlf & _
    "you have not moved, renamed or deleted it.", 48, "File or Folder Error"
    end if

    End If
    Next 'i

    strlog = "-------" & vbnewline & "Backup on " & now() & vbnewline
    strlog = strlog & join(arrResults, vbnewline) & vbnewline & "= " & count & " files copied to " & BackupPath & vbnewline & vbnewline
    call logresults ( strlog )

    ViewLog = msgbox("Backup to " & BackupPath & " Completed..." & vbnewline & "There were " & count & " files copied" &_
    vbnewline & "Would you like to view the backup log now ?", vbyesno + 32 + 256, "Tom's Cool Backup Script")
    if ViewLog = 6 then 'yes
    Set WshShell = WScript.CreateObject( "WScript.Shell" )
    WshShell.Run ("""C:\Backuplog.txt""") 'open log file
    end if

    Set WshShell = nothing
    set fso = nothing
    wscript.quit

    '----------------
    'Performes the actual copying if required
    Sub Backup( mypath )

    if ExcludeF( mypath ) = False then
    Set fldr = fso.GetFolder( myPath )
    'Set fc = fldr.Files
    For Each f in fldr.Files
    DoEvents
    If not fso.folderExists( BackupPath & right(myPath, len(myPath)-3 )) then
    call MakeFolderPath( BackupPath & right(myPath, len(myPath)-3 ))
    End if
    If fso.DriveExists( mypath ) Then 'it is a drive
    backfolder = BackupPath
    else 'it is a folder
    backfolder = BackupPath & right(fldr, len(fldr)-3 ) & "\"
    end if


    ext = right(Lcase(f.name), 3) '-------
    ' FILE TYPES NOT TO BACK UP
    '-------
    if ext <> "tmp" then

    backupfile = backfolder & f.name

    If fso.fileExists( backupfile ) then
    if fso.GetFile(f).DateLastModified > fso.GetFile(backupfile).DateLastModified then
    fso.CopyFile f, backfolder, true
    count = count + 1
    ReDim Preserve arrResults(count)
    arrResults(count) = f
    end if
    Else 'does not yet exist in backup
    fso.CopyFile f, backfolder, true
    count = count + 1
    ReDim Preserve arrResults(count)
    arrResults(count) = f
    End if
    end if ' if ext.. that checked for filetype
    DoEvents

    Next 'f1

    For Each Folder In fldr.SubFolders
    Call Backup(Folder)
    Next 'Folder

    End if 'ExcludeF( mypath ) = False
    End Sub

    '-----------------
    'performs the actual copying of Files if the path was a file - not folder
    Sub FileBackup( myFile )

    set f = fso.GetFile( myFile )
    backupfile = BackupPath & f.name

    If fso.fileExists( backupfile ) then 'already exists in backup
    if fso.GetFile(f).DateLastModified > fso.GetFile(backupfile).DateLastModified then
    fso.CopyFile f, BackupPath , true
    count = count + 1
    ReDim Preserve arrResults(count)
    arrResults(count) = f
    end if
    Else 'does not yet exist in backup
    fso.CopyFile f, BackupPath , true
    count = count + 1
    ReDim Preserve arrResults(count)
    arrResults(count) = f
    End if 'fso.fileExists( backupfile ) then

    End Sub

    '------------------
    'if the folder does not yet exist in the backup path, make it.
    Sub MakeFolderPath( myfolder )
    For x = drv to len( myFolder )
    MyChr = mid( myFolder , x, 1)
    if mychr = "\" then
    xfolder = left(myfolder, x-1)
    if not fso.folderExists ( xFolder ) then
    fso.CreateFolder( xFolder )
    end if
    end if
    Next 'x
    if not fso.folderExists ( myFolder ) then
    fso.CreateFolder( myFolder )
    end if
    End sub

    '----------------
    'function that writes results to the log.txt
    Sub LogResults( myText )
    myfile = "C:\Backuplog.txt"

    Set fso = CreateObject("Scripting.FileSystemObject")
    OutFile = "C:\#temp#.txt"
    set textstream = fso_OpenTextFile(myFile,1,true)
    Set OutStream=fso.CreateTextFile(OutFile,True)

    OutStream.WriteLine( mytext )

    Do until textstream.AtEndOfStream 'writes existing text to temp file
    OneLine = textstream.ReadLine
    OutStream.WriteLine(oneline)
    if instr(Oneline, "----") then 'finds start of each backup log
    logcount = logcount + 1
    if logcount >= 5 then
    exit do
    end if
    end if
    Loop

    textstream.close
    OutStream.Close
    fso.CopyFile OutFile, myfile, true
    fso.DeleteFile OutFile
    End Sub

    '----------------

    Function ExcludeF(qF)
    'On error resume next
    for q = 1 to Excl_Quantity
    if right(Excl_Data(q), 1) = "\" then
    Excl_Data(q) = left(Excl_Data(q), len(Excl_Data(q))-1) 'removes last \
    end if

    If lcase(qF) = lcase(Excl_Data(q)) then
    ExcludeF = True
    Exit Function
    End if
    Next 'q

    ExcludeF = False
    End Function

    '----------------

    Function Excludefolder(qFolder)
    'On error resume next
    for q = 1 to Excl_Quantity
    if right(Excl_Data(q), 1) = "\" then
    Excl_Data(q) = left(Excl_Data(q), len(Excl_Data(q))-1) 'removes last \
    end if

    If lcase(qFolder) = lcase(Excl_Data(q)) then
    Excludefolder = True
    Exit Function
    End if
    Next 'q

    Excludefolder = False
    End Function

    '-------------------

    Sub DoEvents
    'To cause script delays to allow system to still be used (doevents)
    On error resume next
    wscript.sleep 1 'milliseconds
    End Sub
    '-------------------

    Sub CheckPath
    'To ensure the backup path is not inside a folder being backed up

    for p = 1 to Quantity
    if not MyData(p) = "" then
    if lcase(left(BackupPath , len(MyData(p)))) = lcase(MyData(p)) then
    msgbox "You cannot back up a folder to a folder inside it" & vbcrlf &_
    "because it will also backup the backup etc." & vbcrlf & vbcrlf &_
    "Please use a different BackupPath." & vbcrlf & vbcrlf &_
    "This backup has been cancelled.", 64, "Error in BackupPath "
    wscript.quit
    end if 'left(BackupPath , len(MyData(p))) = MyData(p)
    end if ' not MyData(p) = ""
    next 'p

    End Sub
    '------------end of script------------
     
  7. usmc-ratman

    usmc-ratman Thread Starter

    Joined:
    Aug 6, 2004
    Messages:
    140


    Fredledingue --> That looks impressive, but could you tell me how to start the code, what do I copy and paste the code in, ect. Like I said in one of the other posts - I am illiterate, but willing to read and learn. :D
     
  8. Rockn

    Rockn

    Joined:
    Jul 29, 2001
    Messages:
    21,334
    It's a wsh script. Kind of long winded just to back up certain folders. Why are you attempting this anyway? If you have certain files that need to be backed up and renaming the file in the process. Don't you have backup software that will do it better than a script or batch file? Most newer OS's already have backup utilites that work just fine for basic backups.
     
  9. Mosaic1

    Mosaic1

    Joined:
    Aug 17, 2001
    Messages:
    7,486
    Holy smokes. Let's keep it simple. This is not a difficult task. If you put a script in the same folder as the files you will not need much. This will just create a subfolder inside the origianal and then copy the two files into it. BUT for housekeeping you might like to delete any of the backup folders if they are a week old. IOW which have been backed up by the weekly backup.

    If you want to write a script you need to supply the exact path and filenames in question.
     
  10. Mosaic1

    Mosaic1

    Joined:
    Aug 17, 2001
    Messages:
    7,486
    Here's a simple example. I wrote a vbs and put it in the C:\ Drive. I have two files named 1.txt and 2.txt also in C:\


    This will create a folder named Tuesday, August 31, 2004 so now you have a new folder >> C:\ Tuesday, August 31, 2004 ( if run today).

    This script checks first to see if the folder already exists and if so alerts the user and exits.
    If the folder doesn't already exist then it Creates the folder and then copies 1.txt and 2.txt into it.

    To create this vbs open Notepad and copy the contents of the code box into it. Name the file as Backups.vbs
    Save as type:All files
    Save it in the C:\ drive for this example.
    Double click on Backups.vbs to run it.
    If you are starting the Computer each day you could add it to the Startups. Or there are other ways to schedule it to run. But yo do not want this eating up a lot of CPU or memory.

    Code:
    Dim fso,N
    Set fso = Wscript.CreateObject("Scripting.FilesystemObject")
    N = FormatDateTime(Date, 1)
    
    If Not fso.FolderExists(N) Then
    fso.CreateFolder(N)
    fso.CopyFile "1.txt" , N & "\1.txt"
    fso.CopyFile "2.txt", N & "\2.txt"
    Else MsgBox "Folder already exists"
    Wscript.quit
    End IF
    
    MsgBox "Done"
    Ideally, to avoid an error we would also have the script check for the existence of the two files before it tried to copy them to avoid an error. A lot of code is written to prevent an error aborted script. We would also alert the User if either file didn't exist so they could take appropriate action.
     
  11. Mosaic1

    Mosaic1

    Joined:
    Aug 17, 2001
    Messages:
    7,486
    In fact, as I think of it a better idea would be to create a subfolder named BU and add the dated folders into that. Then keep track of the ages of the subfolders there and delete any older than 7 days. Let me know what you think.
     
  12. Mosaic1

    Mosaic1

    Joined:
    Aug 17, 2001
    Messages:
    7,486
    I decided to write a working version. The lines in the script beginning with an apostrophe are comments. They explain to you,the user, what each section of code does. Rules are the same. Create the script and add it to the C:\ Drive. Create two text files there too, C:\1.txt and C:\2.txt which will be copied to the subfolder created in C:\BU when the script is run. Read it through and see if you understand. All that will be left to do will be to change the location of the script to the actual folder where the two files you want to copy live, and the correct names of the two files you want to copy. Possibly the message boxes used to alert the user if there is a problem too.

    Code:
    Dim fso, N , f , directory, fc, f1 ,msg
    Set fso = Wscript.CreateObject("Scripting.FilesystemObject")
    N = FormatDateTime(Date, 1)
    
    'Ascertain if both files you want to copy exist.
    'If not, then alert the user and quit without copying anything.
    
    If not fso.fileExists("1.txt") then msg = "1.txt missing"
    If not fso.fileExists("2.txt") then msg = msg & " " & "2.txt missing"
    If msg <> "" then 
    MsgBox msg & vbcrlf & "Quitting. No Files Copied." & vbcrlf & "Check with your Supervisor."
    Wscript.quit
    End if
    
    'See if the BU folder (Where you will create the backup subfolders) exists.
     'If not then create it.
    
    If Not fso.FolderExists("BU") Then
      fso.CreateFolder("BU")
      MsgBox "Creating BU Folder"
    End IF
    
    
    '-----------------------
    'Delete any subfolders older than 7 days from the BU folder.
    
    Set directory = fso.GetFolder("BU")
    Set fc = directory.SubFolders
    
        For each f1 in fc
          fso.GetFolder(f1)
          If  DateDiff("d", f1.DateCreated , Now) > 7 Then fso.DeleteFolder(f1) 
        Next
    
    '------------------------
    
    
    'Check to see if  Today's folder already exists.
    'If not, create it and copy the two files.
    'If so, then alert the User and end the script.
    
    
    If Not fso.FolderExists("BU\" & N) Then
      
       fso.CreateFolder("BU\" & N)
       fso.CopyFile "1.txt" , "BU\" & N & "\1.txt"
       fso.CopyFile "2.txt", "BU\" & N & "\2.txt"
    
       Else MsgBox "Folder already exists." & vbcrlf & "No Files Copied."
       Wscript.quit
    End IF
    
    '------------------------
    
    
    MsgBox "Done"
     
  13. Fredledingue

    Fredledingue

    Joined:
    Aug 22, 2003
    Messages:
    378
    usmc-ratman

    Copy-paste the script in Notepad, save it as BackItUp.vbs (not the vbs extention).
    Find this file in Explorer, double-clic on it.

    Note, that I never tried this script myself: use it at your own risk. But its by reading examples that I learned scripting.

    Here is a script to detect files changed since "n" days. I also didn't try it but I assume it should work.


    'Detect files changed since "n" days
    '-----------------------------------

    Function FilesModifiedSince (FolderSpec, Days)
    Dim fso, fc, f, d
    Set fso = CreateObject("Scripting.FileSystemObject")
    Set fc = fso.GetFolder(FolderSpec).Files
    Set d = CreateObject("Scripting.Dictionary")

    For Each f in fc
    If DateDiff("d", f.DateLastModified, Now) <= Days Then d.Add f, f.DateLastModified
    Next
    Set fso = Nothing
    Set fc = Nothing
    Set FilesModifiedSince = d
    End function

    ' Example, get all the files modifed since 5 days
    ' in the specified directory
    Dim a, f

    Set f = FilesModifiedSince("c:\dev\work\scripting", 5)
    a = f.keys
    b = f.items

    For i = 0 To f.count - 1
    WScript.Echo a(i) & " " & b(i)
    Next

    Set f = Nothing
    WScript.Quit(0)
     
  14. guard

    guard

    Joined:
    Jun 17, 2004
    Messages:
    10
    You could also use the Advanced Snapshot script that comes with ntlib.cmd. This script requires nothing but the builtin commands and utilities present in every installation of Windows NT4, 2000, XP and Server 2003.

    The fully commented Cmd Source is here. The help screen is reproduced below.

    Code:
      ^   =========================================================================
     /~\    Snapshot Advanced Release 2004.03.28 (Free from TheSystemGuard.com!)
    /cmd\ =========================================================================
    
     Create a snapshot backup when a file changes.
    _______________________________________________________________________________
    
    TSG_Snapshot [/?] [drive:][path]FileToProtect [SafeLocation] [Interval]
    
    SWITCHES:
     /?    Display this help.
    
    PARAMETERS:        Default values are shown in {}'s
     FileToProtect     A SINGLE file to protect (no wildcards!)
     [SafeLocation]    Folder to hold snapshots          {C:\!Snapshot}
     [Interval]        Minutes between file checks       {5}
    
    ERRORLEVELS:
     0 = Normal or expected finish.
     1 = Help screen was displayed.
     2 = Script exited with a known error.  See %ErrorMsg% for details.
     3 = Script exited with an unspecified error.
    
    NOTES:
     The SafeLocation folder will be created if necessary.
    
     Interval time DOES NOT include time spent comparing and copying files.
     The Interval counter is reset at the beginning of each waiting period.
     Actual wait time is NOT PRECISE, and can overshoot by several seconds,
     depending upon system load (see the .Wait command).
    
     If any optional parameter is used, all optional parameters to it's left MUST
     be specified.  For example, to use Interval, also specify SafeLocation.
    
     All Advanced Scripts (those prefixed with "TSG_") from TheSystemGuard.com
     REQUIRE the Advanced NT/2K/XP/K3 Command Library (ntlib.cmd).  This library
     provides over 200 resources for writing, testing and maintaining RELIABLE
     shell scripts using only the native commands and utilities that are present in
     ALL NT-based operating systems.  Write a script ONCE using ntlib.cmd and your
     script will perform CONSISTENTLY under Windows NT4, 2000, XP and Server 2003!
     Request your FREE copy of the Advanced Library today at (http://ntlib.com).
    
    *******************************************************************************
    
     Snapshot Expert uses the enlarged "Expert Command Library" (NTCmdLib.cmd),
     enabling many additional command line switches and parameters.  All Expert
     Scripts (those prefixed with "!") are complete, ready-to-run applications
     that do not require any commands or utilities not already present in every
     NT/2K/XP/K3 install.  !Scripts are distributed uncompressed and are fully
     commented so you can quickly fashion them to your specific requirements.
    
     An example of what you're missing (from the help screen of !Snapshot.cmd):
    
    SWITCHES:   Default values are shown in {}'s
     /C    Compact window during run (size restored at Final Report). {off}
     /FP   FullPath (use the full path of FileToProtect in window title) {name.ext}
     /NV   NoVisual (don't change console colors to reflect operating status) {on}
     /P    Pause (pause console after Final Report) {off}
     /WF   WaitforFile (bypass error if FileToProtect does not exist) {off}
    
    PARAMETERS:        Default values are shown in {}'s
     [Warning_Trigger] Consecutive missed snapshots before warning. {1}
     [Error_Trigger]   Consecutive missed snapshots before error.   {2}
     [MaxSnaps]        Maximum snapshots to take before stopping.  {25}
     [MaxTime]         Maximum time (in minutes) to wait.         {480} (8 hours)
    
     !Snapshot.cmd provides a color-coded, self-adjusting console window to enable
     at-a-glance monitoring of all running snapshots while using minimum desktop
     real estate.  We also include a ".reg" file to allow right-click access to the
     !Snapshot script from inside Windows Explorer.  Just highlight any file, then
     right-click, and select "Protect with !Snapshot".
    
     Both the Expert Command Library and !Snapshot are "Almost Free" at $9 or less!
     See (http://TheSystemGuard.com/AlmostFree.asp) for The Almost Free Price List.
    
     The VERY LATEST KNOWLEDGE pertaining to the Windows NT/2K/XP/K3 command line
     can be found at TheSystemGuard.com.  Check the MasterCatalog often for a
     continually growing collection (http://TheSystemGuard.com/MasterCatalog.asp).
     You'll learn to build RELIABLE and MAINTAINABLE shell scripts that will always
     perform CONSISTENTLY on every Windows NT-based system right out of the box!
     Don't forget our FREE KnowledgeLetter at (http://BoomingOrFuming.com) and...
    
              Congratulations On Your Decision To RISE ABOVE THE REST!!!
    _______________________________________________________________________________
    
    TSG_Snapshot [/?] [drive:][path]FileToProtect [SafeLocation] [Interval]
    
    
     
  15. usmc-ratman

    usmc-ratman Thread Starter

    Joined:
    Aug 6, 2004
    Messages:
    140
    Just wanted to say thanks to everyone for their help.
    The script written by Mosiac1 is the one that I have been working with, and does exactly what I was needing, and is simple enough for me to tweak.
    Great work everyone ! Two (y)
    -JR
     
  16. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/268594

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice