What have you tried? Look in the FAQ section for an example of recursing through folders. Essentially you will need to look at every file in the path you specify for a file matching your search criteria.
--------------------------------------------------------------------------------
dm4ever
My philosophy: K.I.S.S - Keep It Simple Stupid
set oFSO = WScript.Createobject ("Scripting.FileSystemObject")
set FSO = CreateObject ("Scripting.FileSystemObject")
set objNetwork = CreateObject ("WScript.Network")
The information you gave did work. I msgbox NotesID, just to see what the output would be, which I set to "C:\Lotus\Notes\Data" & strUserName & " .id". It displayed the entire statement. I would like to just display the result of & strUserName & " .id". That is the file that I'm trying to backup.
[1] Correction
>[self]Add overwrite flag to true, else repeated execution will be a runtime error.
This is incorrect, my fault. After checking the documentation again, the default of overwrite flag is true, so omitting that flag is okay and will not result in runtime by repeated execution. So with or without true flag is fine as long as it is not false.
[2] There is another typo.
>ldFile = oFile.DataLastModified
[tt]ldFile = oFile.Dat[red]e[/red]LastModified[/tt]
[3] I must confess I still cannot figure out whether eventual working or not for you. In any case, this is one possible cleanup version where some info not fully used is left untouched.
[tt]
Dim FSO, NotesID, objNetwork, strUserName, ldFile
set FSO = WScript.Createobject ("Scripting.FileSystemObject")
set objNetwork = CreateObject ("WScript.Network")
if FSO.fileexists(NotesID) then
set oFile = FSO.GetFile (NotesID)
ldFile = oFile.DateLastModified
FSO.CopyFile NotesID, "C:\NotesBackup"
set oFile=nothing
else
wscript.echo "file: " & NotesID & " cannot be found."
end if
set objNetwork=nothing
set FSO=nothing
[/tt]
The destined file is name "NotesBackup" (not a foldername). But if there exists a folder named c:\NotesBackup, it is a runtime error. This will be the only main source of error untreated in the script. You can check the existence of it before issuing copyfile instruction. Like this.
[tt]
if FSO.folderexists("C:\NotesBackup") then
wscript.echo "Warning: backup filename collides with an existing folder. Operation aborted."
else
FSO.CopyFile NotesID, "C:\NotesBackup"
end if
[/tt]
I feel over-elaborated on simple thing!
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.