CleanCode logo
sitemap
SEARCH:

CleanCode PowerShell Libraries v1.2.08 API: CleanCode » FileTools » New-FileTree

New-FileTree

NAME

New-FileTree

SYNOPSIS

Generates a file tree skeleton (i.e. real directories and files, but the files are empty) from a list of paths.

SYNTAX

New-FileTree [[-Path] <String[]>] [<CommonParameters>]

DESCRIPTION

New-FileTree generates a set of directories and empty files from a list of paths you provide. Any intermediate directories are created automatically; you do not need to explicitly create them. To explicitly create a directory, a path must end in a trailing slash. Either virgules (/) or backslashes (\) may be used in paths.

PARAMETERS

-Path <String[]>
        Specifies a path to one or more locations.
        This may be provided as an array of path strings
        or as a 'here string', with one path per line. (See the examples.)

        Required?                    false
        Position?                    1
        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 New-FileTree.

OUTPUTS

Array of System.IO.FileInfo or System.IO.DirectoryInfo objects.

NOTES



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

        Since CleanCode 1.1.03.

EXAMPLES


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

PS>$result = New-FileTree $testdir\foo1.txt,$testdir\foo2.txt,$testdir\temp1.zip

Creates the path specified in $testdir if it does not yet exist plus the three files specified as a list on one line.

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

PS>

$result = New-FileTree @" $testdir\subdir1\s1a1.txt $testdir\subdir1\s1a2.txt $testdir\subdir2\s2b1.txt $testdir\subdir2\s2b2.txt "@

Creates the files specified in the here list (as well as any intermediate paths needed).

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

PS>

$result = New-FileTree @" foo\bar\abc.txt foo\bar\def.txt foo\gollum\stuff1.txt

foo\other dir\ foo/other2/ #foo/commented-out/ "@

Creates the files and directories specified in the here list, ignoring those commented out (#) and ignoring blank lines. Directories are differentiated by the trailing slash.

RELATED LINKS

-none-

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