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
766 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 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 34

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 54

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

Forrester Webinar: xMatters Delivers 261% ROI

Guest speaker Dean Davison, Forrester Principal Consultant, explains how a Fortune 500 communication company using xMatters found these results: Achieved a 261% ROI, Experienced $753,280 in net present value benefits over 3 years and Reduced MTTR by 91% for tier 1 incidents.

Question has a verified solution.

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

Suggested Solutions

How to record audio from input sources to your PC – connected devices, connected preamp to record vinyl discs, streaming media, that play through your audio card: Vista, Windows 7, Windows 8, Windows 8.1 and Windows 10 – both 32 bit & 64.
The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
The viewer will learn how to successfully create a multiboot device using the SARDU utility on Windows 7. Start the SARDU utility: Change the image directory to wherever you store your ISOs, this will prevent you from having 2 copies of an ISO wit…
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…

738 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