Return to Snippet

Revision: 13308
at November 6, 2009 20:35 by Vordreller


Updated Code
Function writeAllPaths([string]$fromFolder,[string]$filter,[string]$printfile) {
    Get-ChildItem -Path $fromFolder -Recurse $filter | Select-Object -Property FullName > $printfile
}

Revision: 13307
at April 18, 2009 13:37 by Vordreller


Initial Code
Function listAllPaths([string]$fromFolder,[string]$filter,[string]$printfile)
{
    Get-ChildItem -Path $fromFolder -Recurse $filter | Select-Object -Property FullName > $printfile
}

Initial URL


Initial Description
First of all, for all Stackoverflow.com members who have seen my question about this snippet on Stackoverflow, yes I am the same person as WebDevhobo. Last time I asked a question about something I posted here I got a bucketload of comments saying I couldn't claim the work of that snippet to be mine >_>



This is a function for Windows Powershell. What this will do is create a list of all paths that lead to a  certain file on your computer.


Example input: `listAllPaths c:\ *.zip c:\allZips.txt`

This will create a file allZips.txt under your root harddrive(the third parameter). The content will be a list of all paths to every file that ends with the  characters .zip(second parameter) and Powershell will start looking from c:\(the first parameter)

You'll have to make sure Powershell knows the function first. So you'll have to add it to your Powershell profile, which will make it so that every time you start Powershell, you can use the function.

More info on the Powershell profile can be found [here][1]


  [1]: http://superuser.com/questions/63446#63458

Initial Title
Create a textfile listing all paths to a certain file or wildcard.

Initial Tags
list, path, search, windows

Initial Language
Windows PowerShell