Solved

How to list files in a folder - find all files modified on a single date AND owned by FRED

Posted on 2014-04-09
5
731 Views
Last Modified: 2014-04-10
Does anyone know of a tool, ideally command line that will list files in a folder and subfolders that are modified on 1st April 2014, and owner is FRED.

Command line tool would be useful because I need results in a txt or CSV file

Many thanks for help
String,
0
Comment
Question by:TreadStone_IT
5 Comments
 
LVL 26

Accepted Solution

by:
MacroShadow earned 500 total points
ID: 39990922
Try running this VBScript, it will create a tab delimited text file showing different file attributes:
Dim StrFolder
StrFolder = "C:\Users\MacroShadow\Test\" ' Doesn't care if UNC has terminating backslash or not
GetFileAttributes (StrFolder)

Private Sub GetFileAttributes(StrFolder)
    Dim objShell, objFolder, objFSO, strFileName, objFile, strDisplayText, i
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set objFile = objFSO.CreateTextFile("C:\Users\MacroShadow\Test\output.txt", True)
    Set objShell = CreateObject ("Shell.Application")
    Set objFolder = objShell.Namespace(StrFolder)
    Dim arrHeaders(13)
    For i = 0 To 13
        arrHeaders(i) = objFolder.GetDetailsOf(objFolder.Items, i)
    Next
    For Each strFileName In objFolder.Items
        strDisplayText = ""
        If objFolder.GetDetailsOf(strFileName, 3) = #01/04/2014# And objFolder.GetDetailsOf(strFileName, 10)="Fred" Then
	        ' Comment out any attributes you don't want
	        strDisplayText = arrHeaders(0) & ": " & objFolder.GetDetailsOf(strFileName, 0)                                          'File Name
	        strDisplayText = strDisplayText & vbTab & arrHeaders(1) & ": " & objFolder.GetDetailsOf(strFileName, 1)     'File Size
	        strDisplayText = strDisplayText & vbTab & arrHeaders(2) & ": " & objFolder.GetDetailsOf(strFileName, 2)     'Item Type
	        strDisplayText = strDisplayText & vbTab & arrHeaders(3) & ": " & objFolder.GetDetailsOf(strFileName, 3)     'Date Modified
	        strDisplayText = strDisplayText & vbTab & arrHeaders(4) & ": " & objFolder.GetDetailsOf(strFileName, 4)     'Date Created
	        strDisplayText = strDisplayText & vbTab & arrHeaders(5) & ": " & objFolder.GetDetailsOf(strFileName, 5)     'Date Accessed
	        strDisplayText = strDisplayText & vbTab & arrHeaders(6) & ": " & objFolder.GetDetailsOf(strFileName, 6)     'Attributes
	        strDisplayText = strDisplayText & vbTab & arrHeaders(7) & ": " & objFolder.GetDetailsOf(strFileName, 7)     'Offline Status
	        strDisplayText = strDisplayText & vbTab & arrHeaders(8) & ": " & objFolder.GetDetailsOf(strFileName, 8)     'Offline Availability
	        strDisplayText = strDisplayText & vbTab & arrHeaders(9) & ": " & objFolder.GetDetailsOf(strFileName, 9)     'Perceived type
	        strDisplayText = strDisplayText & vbTab & arrHeaders(10) & ": " & objFolder.GetDetailsOf(strFileName, 10)  'Owner
	        strDisplayText = strDisplayText & vbTab & arrHeaders(11) & ": " & objFolder.GetDetailsOf(strFileName, 11)  'Kind
	        strDisplayText = strDisplayText & vbTab & arrHeaders(12) & ": " & objFolder.GetDetailsOf(strFileName, 12)  'Date Taken
	        strDisplayText = strDisplayText & vbTab & arrHeaders(13) & ": " & objFolder.GetDetailsOf(strFileName, 13)  'Contributing Artists
	        objFile.WriteLine strDisplayText
        End if
    Next
End Sub

Open in new window


Don't forget to change the paths on lines 2 and 8 to reflect your details.
0
 
LVL 32

Expert Comment

by:ste5an
ID: 39991115
There are no owners in MS DOS..

Using the Cmd Shell: FORFILES /D to get the files and DIR /Q or CACLS to get the owner.
0
 
LVL 51

Expert Comment

by:Bill Prew
ID: 39991877
Have you tried DIR /Q to see if it shows the owner info you are looking for?  If these are files on a network share it may.  If it does, then the rest could be done in a DOS bat script.

~bp
0
 

Author Comment

by:TreadStone_IT
ID: 39992975
Thanks everyone who read\responded to my question. The DIR /q gave me the info I needed but not in a format I could easily use.
The VB script gave me a csv file that I could manipulate.
Many thanks again
Have a great weekend
String
0
 

Author Closing Comment

by:TreadStone_IT
ID: 39992976
Thanks a bunch!!!
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

New Windows 7 Installations take days for Windows-Updates to show up and install. This can easily be fixed. I have finally decided to write an article because this seems to get asked several times a day lately. This Article and the Links apply to…
When you start your Windows 10 PC and got an "Operating system not found" error or just saw  "Auto repair for startup". After a while, you have entered a loop for Auto repair which does not fix anything and you will be in a  panic as all your work w…
This tutorial will walk an individual through the steps necessary to enable the VMware\Hyper-V licensed feature of Backup Exec 2012. In addition, how to add a VMware server and configure a backup job. The first step is to acquire the necessary licen…
This tutorial will walk an individual through the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now