Advertisement
Guest User

Untitled

a guest
May 20th, 2018
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $position = 0                       #Create variable so that we can add an index to each item
  2.  
  3. Get-ChildItem -Path .\Generated |   #Get each file in the folder
  4.     ForEach-Object {                #creates a loop to work on each item that get-childitem finds
  5.         $position++                 #Add 1 for every item so that we can have multiple files
  6.         Import-Csv .\Generated\MostRecentlyAccessed*.csv |
  7.             Where-Object{$_.Filename -notlike "{*}{*}"} |                   #Remove filename junk
  8.             Where-Object{$_.Filename -notlike "VM_*"} |                     #Remove filename junk - voicemails
  9.             Where-Object{$_.Folder -notlike "*\AppData\*"} |                #Remove folder junk - AppData
  10.             Where-Object{$_.Folder -notlike "*\IntelGraphicsProfiles"} |    #Remove folder junk - IntelGraphicsProfiles
  11.             Where-Object{$_.Folder -notlike "*\xTools\*"} |                 #Remove folder junk - xTools
  12.             Where-Object{$_.Folder -notlike "*RECYCLE.BIN*"} |              #Remove folder junk - Recycling Bin    
  13.             Export-Csv .\Filtered\Filtered$position.csv -NoTypeInformation  #Output to a new CSV file
  14.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement