File explorer - searches

%3CLINGO-SUB%20id%3D%22lingo-sub-198422%22%20slang%3D%22en-US%22%3EFile%20explorer%20-%20searches%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-198422%22%20slang%3D%22en-US%22%3E%3CP%3EI%20am%20preparing%20to%20move%20a%20complete%20document%20library%20from%20a%20network%20drive%20to%20OneDrive%20and%20SharePoint%2C%20but%20before%20I%20can%20do%20that%2C%20I%20would%20like%20to%20clean%20up%20old%20files.%3C%2FP%3E%3CP%3EIn%20my%20folders%20there%20are%20more%20than%20100.000%20files%26nbsp%3Bgoing%20back%26nbsp%3B6-8%20years%20or%20so.%20Is%20there%20an%20easy%20way%20to%20extract%20from%20file%20explorer%20a%20list%20of%20files%20that%20have%20not%20been%20moditied%20or%20opened%20in%20e.g.%203%20years%3F%20Including%20data%20on%20creation%20date%2C%20last%20modified%20date%2C%20author%2C%20last%20modified%20by%2C%20and%20the%20location%20of%20the%20file%20(folder).%3C%2FP%3E%3CP%3EI%20would%20like%20to%20copy%20the%20list%20to%20Excel.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-203252%22%20slang%3D%22en-US%22%3ERe%3A%20File%20explorer%20-%20searches%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-203252%22%20slang%3D%22en-US%22%3E%3CP%3EThat%20is%20interesting%2C%20I%20don't%20think%20PowerShell%20should%20have%20issues%20with%20a%20%22-%22%20in%20the%20name.%26nbsp%3B%20I%20did%20notice%20that%20I%20didn't%20allow%20for%20that%20script%20to%20search%20down%20below%20the%20one%20level%20of%20the%20folder%20you%20list%20by%20name.%26nbsp%3B%20You%20can%20add%20the%20%22-recurse%22%20parameter%20to%20the%20command%20to%20search%20all%20levels%20below%20just%20the%20top%20level.%26nbsp%3B%20Hope%20this%20helps!%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHere's%20the%20updated%20code%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EGet-ChildItem%20C%3A%5CUsers%5C%3CUSER%3E%5CDocuments%20-recurse%20%7C%20Select%20Name%2C%20LastWriteTime%2C%20LastAccessTime%20%7C%20Export-Csv%20-Path%20C%3A%5CUsers%5C%3CUSER%3E%5CDocuments%5CFileList.csv%20-NoTypeInformation%3C%2FUSER%3E%3C%2FUSER%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-201341%22%20slang%3D%22en-US%22%3ERe%3A%20File%20explorer%20-%20searches%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-201341%22%20slang%3D%22en-US%22%3EThanks.%20I%20will%20try%20this.%3CBR%20%2F%3EI%20seem%20to%20have%20a%20problem%20with%20the%20naming%20of%20my%20folders%20-%20PowerShell%20doesn't%20accept%20folders%20with%20%22-%22%20in%20the%20name.%20Anyway%20to%20solve%20this%3F%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-198461%22%20slang%3D%22en-US%22%3ERe%3A%20File%20explorer%20-%20searches%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-198461%22%20slang%3D%22en-US%22%3E%3CP%3EYou%20can%20try%20using%20a%20script%20like%20this%20in%20PowerShell%2C%20then%20working%20with%20the%20CSV%20file%20it%20creates%20in%20Excel%20to%20find%20the%20data%20you%20need.%26nbsp%3B%20It%20won't%20have%20everything%20you%20asked%20for%2C%20but%20should%20give%20you%20some%20data%20to%20work%20with.%26nbsp%3B%20Hope%20that%20helps!%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EGet-ChildItem%20C%3A%5CUsers%5C%3CUSER%3E%5CDocuments%20%7C%20Select%20Name%2C%20LastWriteTime%2C%20LastAccessTime%20%7C%20Export-Csv%20-Path%20C%3A%5CUsers%5C%3CUSER%3E%5CDocuments%5CFileList.csv%20-NoTypeInformation%3C%2FUSER%3E%3C%2FUSER%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
Deleted
Not applicable

I am preparing to move a complete document library from a network drive to OneDrive and SharePoint, but before I can do that, I would like to clean up old files.

In my folders there are more than 100.000 files going back 6-8 years or so. Is there an easy way to extract from file explorer a list of files that have not been moditied or opened in e.g. 3 years? Including data on creation date, last modified date, author, last modified by, and the location of the file (folder).

I would like to copy the list to Excel.

 

3 Replies
Highlighted

You can try using a script like this in PowerShell, then working with the CSV file it creates in Excel to find the data you need.  It won't have everything you asked for, but should give you some data to work with.  Hope that helps!  

 

Get-ChildItem C:\Users\<user>\Documents | Select Name, LastWriteTime, LastAccessTime | Export-Csv -Path C:\Users\<user>\Documents\FileList.csv -NoTypeInformation

Highlighted
Thanks. I will try this.
I seem to have a problem with the naming of my folders - PowerShell doesn't accept folders with "-" in the name. Anyway to solve this?
Highlighted

That is interesting, I don't think PowerShell should have issues with a "-" in the name.  I did notice that I didn't allow for that script to search down below the one level of the folder you list by name.  You can add the "-recurse" parameter to the command to search all levels below just the top level.  Hope this helps!  

 

Here's the updated code:

 

Get-ChildItem C:\Users\<user>\Documents -recurse | Select Name, LastWriteTime, LastAccessTime | Export-Csv -Path C:\Users\<user>\Documents\FileList.csv -NoTypeInformation