CleanCode logo
sitemap
SEARCH:

CleanCode PowerShell Libraries v1.2.08 API: CleanCode » FileTools » Get-EnhancedChildItem

Get-EnhancedChildItem

NAME

Get-EnhancedChildItem

SYNOPSIS

A variation of Get-ChildItem notably providing the ability to prune trees, isolate Subversion-aware items, and flatten the output for brevity.

SYNTAX

Get-EnhancedChildItem [[-Path] <String[]>] [[-Filter] <String>] [-Include <String[]>] [-Exclude <String[]>] [-Recurse] [-Force] [-Name] [-ExcludeTree <String[]>] [-Svn] [-ContainersOnly] [-NoContainersOnly] [-FullName] [-UseTransaction] [<CommonParameters>]

Get-EnhancedChildItem [-LiteralPath] <String[]> [[-Filter] <String>] [-Include <String[]>] [-Exclude <String[]>] [-Recurse] [-Force] [-Name] [-ExcludeTree <String[]>] [-Svn] [-ContainersOnly] [-NoContainersOnly] [-FullName] [-UseTransaction] [<CommonParameters>]

DESCRIPTION

Get-EnhancedChildItem is a variation of Get-ChildItem, supporting some but not all parameters of its progenitor, while adding some unique ones that enrich its capabilities.

Enhancements include:
* exclude an entire subtree (-ExcludeTree).
* isolate Subversion-aware files and folders (-Svn);
* restrict output to just files (-NoContainersOnly) or just folders (-ContainersOnly);
* generate a concise list of full names (-FullName) similar to the list of simple names provided by Get-ChildItem -Names.

PARAMETERS

-Path <String[]>
        See Get-ChildItem.

        Required?                    false
        Position?                    1
        Default value                
        Accept pipeline input?       true (ByValue, ByPropertyName)
        Accept wildcard characters?  false

-LiteralPath <String[]>
        See Get-ChildItem.

        Required?                    true
        Position?                    1
        Default value                
        Accept pipeline input?       true (ByPropertyName)
        Accept wildcard characters?  false

-Filter <String>
        See Get-ChildItem.

        Required?                    false
        Position?                    2
        Default value                
        Accept pipeline input?       false
        Accept wildcard characters?  false

-Include <String[]>
        See Get-ChildItem.

        Required?                    false
        Position?                    named
        Default value                
        Accept pipeline input?       false
        Accept wildcard characters?  false

-Exclude <String[]>
        See Get-ChildItem.

        Required?                    false
        Position?                    named
        Default value                
        Accept pipeline input?       false
        Accept wildcard characters?  false

-Recurse [<SwitchParameter>]
        See Get-ChildItem.

        Required?                    false
        Position?                    named
        Default value                False
        Accept pipeline input?       false
        Accept wildcard characters?  false

-Force [<SwitchParameter>]
        See Get-ChildItem.

        Required?                    false
        Position?                    named
        Default value                False
        Accept pipeline input?       false
        Accept wildcard characters?  false

-Name [<SwitchParameter>]
        See Get-ChildItem.

        Required?                    false
        Position?                    named
        Default value                False
        Accept pipeline input?       false
        Accept wildcard characters?  false

-ExcludeTree <String[]>
        Excludes not just a matching item but also all its children as well.

        Required?                    false
        Position?                    named
        Default value                @()
        Accept pipeline input?       false
        Accept wildcard characters?  true

-Svn [<SwitchParameter>]
        Ignores files and folders that are not Subversion-aware.

        Required?                    false
        Position?                    named
        Default value                False
        Accept pipeline input?       false
        Accept wildcard characters?  false

-ContainersOnly [<SwitchParameter>]
        Returns only containers (directories).
        Mutually exclusive with -NoContainersOnly.

        Required?                    false
        Position?                    named
        Default value                False
        Accept pipeline input?       false
        Accept wildcard characters?  false

-NoContainersOnly [<SwitchParameter>]
        Returns only non-containers (files).
        Mutually exclusive with -ContainersOnly.

        Required?                    false
        Position?                    named
        Default value                False
        Accept pipeline input?       false
        Accept wildcard characters?  false

-FullName [<SwitchParameter>]
        Retrieves only the full names of the items in the locations. If you pipe
        the output of this command to another command, only the item full names
        are sent.  Mutually exclusive with -Name.

        Required?                    false
        Position?                    named
        Default value                False
        Accept pipeline input?       false
        Accept wildcard characters?  false

-UseTransaction [<SwitchParameter>]
        See Get-ChildItem.

        Required?                    false
        Position?                    named
        Default value                
        Accept pipeline input?       false
        Accept wildcard characters?  false

<CommonParameters>
        This cmdlet supports the common parameters: Verbose, Debug,
        ErrorAction, ErrorVariable, WarningAction, WarningVariable,
        OutBuffer and OutVariable. For more information, see 
        about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216). 

INPUTS

System.String. You can pipe one or more path strings to Get-EnhancedChildItem.

OUTPUTS

Object. The type of object returned is determined by the provider with which it is used.

NOTES



        You can also refer to Get-ChildItem by its built-in alias "gciplus".
        For more information, see about_Aliases.

        Get-EnhancedChildItem does not get hidden items by default.

        This function is part of the CleanCode toolbox
        from http://cleancode.sourceforge.net/.

        Since CleanCode 1.1.01.

EXAMPLES


-------------------------- EXAMPLE 1 --------------------------

PS>Get-EnhancedChildItem

This command gets the child items in the current location.

        Directory: W:\powershell

        Mode                LastWriteTime     Length Name
        ----                -------------     ------ ----
        -a---          6/6/2011   1:12 PM       4833 Get-NewItem.ps1
        -a---          6/6/2011   9:45 AM       9340 keywordCheck.ps1
        -a---          6/6/2011   9:40 AM        488 Parse-CfgFile.ps1
        -a---          6/6/2011  11:07 AM        327 temp.ps1

If the location is a file system directory, it gets the files and sub-directories in the current directory. If the item does not have child items, this command returns to the command prompt without displaying anything.

-------------------------- EXAMPLE 2 --------------------------

PS>Get-EnhancedChildItem . -FullName

Same results as above, but outputs only full names in a single list.

        W:\powershell\Get-NewItem.ps1
        W:\powershell\keywordCheck.ps1
        W:\powershell\Parse-CfgFile.ps1
        W:\powershell\temp.ps1

For a single directory, there is little difference but for many directories, all items appear in a single list, making the output more concise.

-------------------------- EXAMPLE 3 --------------------------

PS>Get-EnhancedChildItem . -Recurse -ExcludeTree *-tmp,doc -Svn

For a large subtree rooted at the current location, this enumerates the entire subtree, pruning any directories named "doc" or those ending in "-tmp", and further restricting the output to Subversion-aware files and folders.

RELATED LINKS

This documentation set was created with CleanCode's DocTreeGenerator.

Valid XHTML 1.0!Valid CSS!Get CleanCode at SourceForge.net. Fast, secure and Free Open Source software downloads
Copyright © 2001-2015 Michael Sorens • Contact usPrivacy Policy
Usage governed by Mozilla Public License 1.1 and CleanCode Courtesy License
CleanCode -- The Website for Clean DesignRevised 2015.12.16