File Not Found Error - UNC?

Tech-Archive recommends: Fix windows errors by optimizing your registry



Afternoon,

I am working through getting a script to grab a file name and the date
it was last modified and am not having any luck with the UNC it would
appear. The script is below and it is erroring on the line below:

Set DatZipFile = fso.GetFile(DatFilePath + Text)

If I msgbox (DatFilePath + Text) the path is correct. I have tried
using the files collection method but I can't properly filter for the
file im looking for. Any help would be greatly appreciated

Cheers

Rob.

-----------------------------------------------------------------------------

set shell = createobject("wscript.shell")
Set WshNetwork = WScript.CreateObject("WScript.Network")
const DatFilePath="\\server\c$\Program
Files\McAfee\ePO\3.0.1\DB\Software\"

set TheArgs = WScript.Arguments
NetworkD = TheArgs.Item(0)

NetworkDrive = NetworkD + ":"

WshNetwork.MapNetworkDrive NetworkDrive,"\\server\c$"

cmd = "%comspec% /c dir dat-*.zip /b | sort"
shell.currentdirectory = NetworkDrive + "\Program
Files\McAfee\ePO\3.0.1\DB\Software\"
set dir = shell.exec(cmd)
text = ""
do while true
if not dir.stdout.atendofstream then
text = text & dir.stdout.readall
end if
if dir.status = 1 then exit do
wscript.sleep 100
loop

WshNetwork.RemoveNetworkDrive (NetworkDrive),true

set shell = Nothing
set WshNetwork = Nothing

Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
Set DatZipFile = fso.GetFile(DatFilePath + Text)
Modified = DatZipFile.DateLastModified

------------------------------------------------------------------------------

.



Relevant Pages