Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

list of files copied inserted to log

Status
Not open for further replies.

moogeboo

MIS
Aug 7, 2003
28
0
0
US
hi,

i have a vb script that copies files in a directory if it detects any files in that directory. This runs every 5 minutes, and it logs when it runs. Now, for debugging purposes, i'd like to be able to specifically log the individual files that it copies and write the filenames of the files into the log.

Set FSo=Createobject("Scripting.FilesystemObject")
fso.COPYFILE "D:\USERS\" & cname & "\INCOMING\*.*","D:\USERS\" & cname & "\ARCHIVE\INCOMING\"

this is basically the method i have to copy the files.
any assistance with this will be appreciated!

thanks
M
 
moogeboo said:
if it detects any files in that directory
How your script detects that ?
I guess the detection routine have provision to write what you want in the log file.

Hope This Help, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884
 
This is just some pseudo code, but should give you an idea of what you need to do:

Set ts = fso.CreateTextFile (strComputer &".txt", ForAppending)
Base = "D:\Users"

For each folder in Base
SubFolder = "D:\Users\" & folder & "\incoming\"
For Each file in SubFolder
If Not fso.FileExists("D:\Users\" & folder & "\incoming\" & file) Then
fso.COPYFILE "D:\USERS\" & folder & "\INCOMING\" & file,"D:\USERS\" & folder & "\ARCHIVE\INCOMING\"
ts.write "D:\USERS\" & folder & "\INCOMING\" & file & " Copied"
End If
Next
Next

I hope you find this post helpful. Please let me know if it was.

Regards,

Mark
 
thanks markdmac...your pseudocode was most helpful!

M
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top