Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>There are a couple of minor issues:</p> <p>1.) Not checking for if a folder exists for calling get folder, this is what was causing your 'Not Found' error.</p> <p>2.) Non-matching If ... Then &amp; End statements in your file loop. (I would probably choose a better editor for vbscript, programmers notepad and notepad++ are very useful.)</p> <p>3.) The StartService() / StopService() mix-up I mentioned previously.</p> <p><pre><code> ' 1. Check that the latest backup zip exists and store its name in LBZ (LatestBackupZip) ' 2. Stop the Livecontent Service ' 3. Remove .dbx, .lck and .log files from DataFolder ' 4. restart the service ' 5. Restore the database</p> <p>Dim fileNewest</p> <p>Dim fso Set fso = WScript.CreateObject("Scripting.FileSystemObject")</p> <p>Set WshShell = WScript.CreateObject("WScript.Shell")</p> <p>Dim ImportFldr</p> <p>If fso.FolderExists( "C:\Program Files (x86)\XyEnterprise\SDL LiveContent\data\Import" ) Then Set ImportFldr = fso.GetFolder("C:\Program Files (x86)\XyEnterprise\SDL LiveContent\data\Import") Else If fso.FolderExists( "C:\Program Files\XyEnterprise\SDL LiveContent\data\export" ) Then Set ImportFldr = fso.GetFolder("C:\Program Files\XyEnterprise\SDL LiveContent\data\export") End If</p> <p>Dim DataFldr</p> <p>If fso.FolderExists( "C:\Program Files (x86)\XyEnterprise\SDL LiveContent\data" ) Then Set DataFldr= fso.GetFolder("C:\Program Files (x86)\XyEnterprise\SDL LiveContent\data") Else If fso.GetFolder("C:\Program diles\XyEnterprise\SDL LiveContent\data") Then Set DataFldr= fso.GetFolder("C:\Program diles\XyEnterprise\SDL LiveContent\data") End If</p> <p>For Each aFile In ImportFldr.Files sExtension = fso.GetExtensionName(aFile.Name)</p> <pre><code>If sExtension = "log" Then 'Msgbox "The file extension is a " &amp; sExtension Else 'Msgbox "The file extension is a " &amp; sExtension If fileNewest = "" Then Set fileNewest = aFile Else If fileNewest.DateCreated &lt; aFile.DateCreated Then If CDate(fileNewest.DateCreated) &lt; CDate(aFile.DateCreated) Then Set fileNewest = aFile End If End If End If End If </code></pre> <p>Next Msgbox "The Newest File in the folder is " &amp; fileNewest.Name &amp; chr(13) &amp; "Size: " &amp; fileNewest.Size &amp; " bytes" &amp; chr(13) &amp; "Was last modified on " &amp; FileNewest.DateLastModified </p> <p>' Change to /Data 'WScript.Echo WshShell.CurrentDirectory WshShell.CurrentDirectory = DataFldr 'WScript.Echo WshShell.CurrentDirectory </p> <p>' Stop the Livecontent service strComputer = "." Dim objService Set objWMIService = GetObject("winmgmts:\" &amp; strComputer &amp; "\root\cimv2")</p> <p>Set colServiceList = objWMIService.ExecQuery _ ("Select * from Win32_Service where Name = 'LiveContent'")</p> <p>For Each objService in colServiceList WScript.Echo objService.State If objService.State = "Running" Then objService.StopService() 'Wscript.Sleep 5000 End If Next</p> <p>'Dim objShell 'Set objShell = CreateObject("WScript.Shell") 'objShell.Run "%comspec% /k c: &amp; cd ""C:\Program Files (x86)\XyEnterprise\SDL LiveContent\"" &amp; """"loaddb RESTORE -'Dlc.file=C:\PROGRA~2\XYENTE~1\SDLLIV~1\data\Import\" &amp; fileNewest.Name &amp; " -Dlc.pswd=N2kAs72z""""" </pre></code></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload