?
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
Medium Priority
?
779 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 27

Accepted Solution

by:
MacroShadow earned 2000 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 35

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 56

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

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is a collection of issues that people face from time to time and possible solutions to those issues. I hope you enjoy reading it.
This article provides a convenient collection of links to Microsoft provided Security Patches for operating systems that have reached their End of Life support cycle. Included operating systems covered by this article are Windows XP,  Windows Server…
Windows 8 came with a dramatically different user interface known as Metro. Notably missing from that interface was a Start button and Start Menu. Microsoft responded to negative user feedback of the Metro interface, bringing back the Start button a…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…

777 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