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!

obtain owner of files

Status
Not open for further replies.

0318

Programmer
Jan 18, 2004
25
0
0
NL
im doing ok now with my script. but now i need a script that checks the owners of files.
ive been looking here for it, and came here:
it runs, it displays the amount of files in the scanned folder, but it doesnt show the owners of the files.
someone knows why?
isnt there a shorter script to check owners of files in 1 directory?
thnx
 
yes ive managed to get the owner on the screen.
next question, is it difficult to include a script in another script?

got this:


Set fso = CreateObject("Scripting.FileSystemObject")
Set objFolder = fso.GetFolder("C:\temp")
For Each aFile In objFolder.Files
Wscript.Echo "Bestandsnaam: "& aFile.Name


Dmod = aFile.DateCreated


maxDays=7

totalDays=DateDiff("D", dMod, Now)
Wscript.Echo "Verstreken dagen sinds neerzetten bestand: " & totalDays

if totalDays>=maxDays then

Wscript.Echo ("Bestand verouderd!")

===============================================
This is the place the other script has to run.
i tried to do it but got errors.. expecting next, syntax errors etc..
===================================================

else
Wscript.Echo ("Check OK")
Wscript.Echo


end if

next


 
The fastest way (but not neccessarily the best) is to open the other script and read it into a var then execute global the var you read it into. The problem with this approach comes from if you use the same variable names in both scripts. Another approach is to re-write the other script as a class and exec it globally. Then you can create an instance of a class to hopefully avoid duplicated variable names. Another approach would be to put both scripts into a wsf and control the execution there. Another approach would be to copy the other script into this one and debug it to work out the kinks. Another and probably the safest approach would be to create a COM object from the other script then use exposed methods to do whatever you need.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top