Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Scripting help... get list of files with owner and date
Message
Information générale
Forum:
Windows
Catégorie:
Administration & Sécurité
Divers
Thread ID:
01108105
Message ID:
01108181
Vues:
18
This message has been marked as a message which has helped to the initial question of the thread.
Alex,

When I realized you did not want to monitor it real-time, I thought I could write the script myself, bad thinking, my scripting abilities are completely rusty <g>

Anyways, I wrote something that should get you started, it is missing the ownership information and, as I said, I do not write scripts very often, so take it with a grain of salt

Create a file with a vbs extension and paste the code below, and to call it use

C:>YourFile YourRootFolder YourDesiredSize

I am not sure how big can YourDesiredSize be
Option ExplicitOption Explicit

Dim oArgs, oRootFolder, oFSO, oFolder, nSize, nDays

Set oArgs = WScript.Arguments

if oArgs.Count = 0 then
	WScript.Echo "Folder name required"
end if

Set oFSO = CreateObject("Scripting.FileSystemObject")
on error resume next
Set oRootFolder = oFSO.GetFolder(oArgs(0))
On Error Goto 0

if oArgs.Count = 2 then
	nSize = clng(oArgs(1))
else
	nSize = 10000
end if

if oArgs.Count = 3 then
	nDays = cInt(oArgs(2))
else
	nDays = 1
end if

if IsObject(oRootFolder) then
	CheckFiles oRootFolder, nSize, nDays
else
	WScript.Echo "Folder " & oArgs(0) & " not found"
end if


Sub CheckFiles(oFolder, nSize, nDays)

Dim oFile

for each oFile in oFolder.Files
	if oFile.Size >= nSize and DateDiff("h", oFile.DateCreated, Now) <= nDays  then
		WScript.Echo oFile.Path & "  " & oFile.Size & "  " & oFile.DateCreated & "  " & DateDiff("h", oFile.DateCreated, Now)
	end if
next
for each oFolder in oFolder.SubFolders
	CheckFiles oFolder, nSize, nDays
next
end sub
[Update]
I added another parameter for the age of the file in days

>I've been reading the website you posted for a couple of hours and, unless I have missed something, haven't found anything that could help me. In particular, it is not structured as a tutorial but more as a show and tell of what it can do.
>
>I will keep reading.
"The five senses obstruct or deform the apprehension of reality."
Jorge L. Borges?

"Premature optimization is the root of all evil in programming."
Donald Knuth, repeating C. A. R. Hoare

"To die for a religion is easier than to live it absolutely"
Jorge L. Borges
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform