< Back
Get-LongChildItem
Post
NAME Get-LongChildItem
SYNOPSIS
Gets the items and child items in one or more specified locations.
SYNTAX
Get-LongChildItem [[-Path] <String>] [[-Filter] <String>] [-Recurse <SwitchParameter>] [-Include <String[]>]
[-Exclude <String[]>] [-Directory <SwitchParameter>] [-File <SwitchParameter>] [-Name <SwitchParameter>]
[-SkipSymbolicLink <SwitchParameter>] [<CommonParameters>]
DESCRIPTION
The Get-LongChildItem cmdlet gets the items in one or more specified locations. If the item is a container, it
gets the items inside the container, known as child items. You can use the Recurse parameter to get items in all
child containers.
PARAMETERS
-Path [<String>]
Specifies a path to one or more locations. Wildcards are NOT permitted. The default location is the current
directory.
Path can be relative or absolute.
Required? false
Position? 0
Default value current directory
Accept pipeline input? True (ByPropertyName, ByValue)
Accept wildcard characters? false
-Filter [<String>]
The value of this parameter qualifies the Path parameter. Filters are more efficient than other parameters,
because the provider applies them when retrieving the objects, rather than having Windows PowerShell filter
the objects after they are retrieved.
Required? false
Position? 1
Default value None
Accept pipeline input? false
Accept wildcard characters? true
-Recurse [<SwitchParameter>]
Gets the items in the specified locations and in all child items of the locations.
Required? false
Position? named
Default value false
Accept pipeline input? false
Accept wildcard characters? false
-Include [<String[]>]
Gets only the specified items. The value of this parameter qualifies the Path parameter. Enter a path element
or pattern, such as "*.txt". Wildcards are permitted.
Required? false
Position? named
Default value None
Accept pipeline input? false
Accept wildcard characters? true
-Exclude [<String[]>]
Omits the specified items. The value of this parameter qualifies the Path parameter. Enter a path element or
pattern, such as "*.txt". Wildcards are permitted.
Required? false
Position? named
Default value None
Accept pipeline input? false
Accept wildcard characters? true
-Directory [<SwitchParameter>]
Gets only the container items in the locations omitting all files.In other words lists only folders and not
files.
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-File [<SwitchParameter>]
Gets only the file items in the locations omitting all container\\directory items.
Required? false
Position? named
Default value None
Accept pipeline input? false
Accept wildcard characters? false
-Name [<SwitchParameter>]
Gets only the names of the items in the locations. If you pipe the output of this command to another command,
only the item names are sent.
Required? false
Position? named
Default value None
Accept pipeline input? false
Accept wildcard characters? false
-SkipSymbolicLink [<SwitchParameter>]
When this switch is used the enumeration will skip over any symboliclinks in the path.
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, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
System.String
You can pipe a string that contains a path to Get-LongChildItem.
OUTPUTS
Alphaleonis.Win32.Filesystem.FileInfo
For more information see:
http://alphafs.alphaleonis.com/doc/2.0/ ... 08A5E5.htm
System.String
If you use the Name parameter, Get-ChildItem returns the object names as strings.
NOTES
You can also refer to Get-LongChildItem by its built-in aliases "ldir", and "lgci". For more information, see
about_Aliases.
Get-LongChildItem gets hidden items by default.
The Get-LongChildItem cmdlet is designed to work with the data exposed by the AlphaFS Filesystem provider and
will NOT work with any other providers E.g.,Registry,Certificates etc
For more information, see (http://alphafs.alphaleonis.com/doc/2.0/ ... 7C1374.htm).
-------------------------- EXAMPLE 1 --------------------------
PS C:\\>Get-LongChildItem -Path C:\\temp -Filter d*.txt -Recurse
Directory: C:\\temp
Mode LastWriteTime Length Name
---- ------------- ------ ----
File 6/27/2015 11:44 AM 1488 drivers.txt
File 7/3/2015 12:30 PM 72 dupes.txt
Directory: C:\\temp\\folder4\\DSC06252
Mode LastWriteTime Length Name
---- ------------- ------ ----
File 8/23/2015 6:24 PM 93 dupes.txt
This command gets all of the files that begin with the letter 'd' followed by any character(s) but end with the
extension 'TXT' in the path directory and its subdirectories. The Recurse parameter directs Windows PowerShell to
get objects recursively, and it indicates that the subject of the command is the specified directory and its
contents.
-------------------------- EXAMPLE 2 --------------------------
PS C:\\>Get-LongChildItem ????????Path C:\\temp -Include *.txt -Exclude A*,c*,e*
This command lists the .txt files in the temp directory, except for those whose names start with the letter A or C
or E.
-------------------------- EXAMPLE 3 --------------------------
PS C:\\>Get-LongChildItem ????????Path C:\\windows\\System32\\WindowsPowerShell -Filter about*.txt -Recurse -Name
This command gets only the names of all Text files that begin with 'about' in the
C:\\windows\\System32\\WindowsPowerShell directory and its subdirectories.
-------------------------- EXAMPLE 4 --------------------------
PS C:\\>Get-LongChildItem ????????Path C:\\temp -Name -Directory -Recurse
This command gets only the names of all directories in the C:\\temp directory and its subdirectories.
-------------------------- EXAMPLE 5 --------------------------
PS C:\\>Get-LongChildItem -Path C:\\temp -Recurse | Where PathLength -gt 260
This command gets all files and folders recursively. The output is then piped to Where-object which displays only
those files whose length exceeds the windows API 260 character length limitation.
-------------------------- EXAMPLE 6 --------------------------
PS C:\\>Get-LongChildItem -Path D:\\Temp
Directory: D:\\Temp
Mode LastWriteTime Length Name
---- ------------- ------ ----
Directory 12/5/2016 9:44 PM 123
File 12/23/2016 2:46 PM 9491 temp.ps1
SymLink-f 12/7/2016 7:21 PM 0 MySymLinkFile.txt
SymLink-f 12/17/2016 12:38 PM 0 MySymLinkFile2.txt
SymLink-d 12/17/2016 12:47 PM symfolder1
SymLink-d 12/17/2016 12:49 PM symfolder2
File 12/25/2016 2:10 AM 4405 test.ps1
File 12/11/2016 1:52 PM 3 testfile1.txt
Directory 12/11/2016 2:26 PM testmodule
File 12/11/2016 2:02 PM 3 thirdfile.txt
The mode property now shows whether a file or folder is a symlink(symboliclink) and additionaly indicates whether
the type is a file or a directory
-------------------------- EXAMPLE 7 --------------------------
PS C:\\>Get-LongChildItem -Path D:\\Temp -SkipSymbolicLink
Directory: D:\\Temp
Mode LastWriteTime Length Name
---- ------------- ------ ----
Directory 12/5/2016 9:44 PM 123
File 12/23/2016 2:46 PM 9491 temp.ps1
File
12/25/2016 2:10 AM 4405 test.ps1
File 12/11/2016 1:52 PM 3 testfile1.txt
Directory 12/11/2016 2:26 PM testmodule
File 12/11/2016 2:02 PM 3 thirdfile.txt
lists all items in d:\\temp with the exception of symboliclinks
-------------------------- EXAMPLE 8 --------------------------
PS C:\\temp>Get-LongChildItem testdir
gets items from the folder 'testdir' located in c:\\temp
RELATED LINKS
SYNOPSIS
Gets the items and child items in one or more specified locations.
SYNTAX
Get-LongChildItem [[-Path] <String>] [[-Filter] <String>] [-Recurse <SwitchParameter>] [-Include <String[]>]
[-Exclude <String[]>] [-Directory <SwitchParameter>] [-File <SwitchParameter>] [-Name <SwitchParameter>]
[-SkipSymbolicLink <SwitchParameter>] [<CommonParameters>]
DESCRIPTION
The Get-LongChildItem cmdlet gets the items in one or more specified locations. If the item is a container, it
gets the items inside the container, known as child items. You can use the Recurse parameter to get items in all
child containers.
PARAMETERS
-Path [<String>]
Specifies a path to one or more locations. Wildcards are NOT permitted. The default location is the current
directory.
Path can be relative or absolute.
Required? false
Position? 0
Default value current directory
Accept pipeline input? True (ByPropertyName, ByValue)
Accept wildcard characters? false
-Filter [<String>]
The value of this parameter qualifies the Path parameter. Filters are more efficient than other parameters,
because the provider applies them when retrieving the objects, rather than having Windows PowerShell filter
the objects after they are retrieved.
Required? false
Position? 1
Default value None
Accept pipeline input? false
Accept wildcard characters? true
-Recurse [<SwitchParameter>]
Gets the items in the specified locations and in all child items of the locations.
Required? false
Position? named
Default value false
Accept pipeline input? false
Accept wildcard characters? false
-Include [<String[]>]
Gets only the specified items. The value of this parameter qualifies the Path parameter. Enter a path element
or pattern, such as "*.txt". Wildcards are permitted.
Required? false
Position? named
Default value None
Accept pipeline input? false
Accept wildcard characters? true
-Exclude [<String[]>]
Omits the specified items. The value of this parameter qualifies the Path parameter. Enter a path element or
pattern, such as "*.txt". Wildcards are permitted.
Required? false
Position? named
Default value None
Accept pipeline input? false
Accept wildcard characters? true
-Directory [<SwitchParameter>]
Gets only the container items in the locations omitting all files.In other words lists only folders and not
files.
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-File [<SwitchParameter>]
Gets only the file items in the locations omitting all container\\directory items.
Required? false
Position? named
Default value None
Accept pipeline input? false
Accept wildcard characters? false
-Name [<SwitchParameter>]
Gets only the names of the items in the locations. If you pipe the output of this command to another command,
only the item names are sent.
Required? false
Position? named
Default value None
Accept pipeline input? false
Accept wildcard characters? false
-SkipSymbolicLink [<SwitchParameter>]
When this switch is used the enumeration will skip over any symboliclinks in the path.
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, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
System.String
You can pipe a string that contains a path to Get-LongChildItem.
OUTPUTS
Alphaleonis.Win32.Filesystem.FileInfo
For more information see:
http://alphafs.alphaleonis.com/doc/2.0/ ... 08A5E5.htm
System.String
If you use the Name parameter, Get-ChildItem returns the object names as strings.
NOTES
You can also refer to Get-LongChildItem by its built-in aliases "ldir", and "lgci". For more information, see
about_Aliases.
Get-LongChildItem gets hidden items by default.
The Get-LongChildItem cmdlet is designed to work with the data exposed by the AlphaFS Filesystem provider and
will NOT work with any other providers E.g.,Registry,Certificates etc
For more information, see (http://alphafs.alphaleonis.com/doc/2.0/ ... 7C1374.htm).
-------------------------- EXAMPLE 1 --------------------------
PS C:\\>Get-LongChildItem -Path C:\\temp -Filter d*.txt -Recurse
Directory: C:\\temp
Mode LastWriteTime Length Name
---- ------------- ------ ----
File 6/27/2015 11:44 AM 1488 drivers.txt
File 7/3/2015 12:30 PM 72 dupes.txt
Directory: C:\\temp\\folder4\\DSC06252
Mode LastWriteTime Length Name
---- ------------- ------ ----
File 8/23/2015 6:24 PM 93 dupes.txt
This command gets all of the files that begin with the letter 'd' followed by any character(s) but end with the
extension 'TXT' in the path directory and its subdirectories. The Recurse parameter directs Windows PowerShell to
get objects recursively, and it indicates that the subject of the command is the specified directory and its
contents.
-------------------------- EXAMPLE 2 --------------------------
PS C:\\>Get-LongChildItem ????????Path C:\\temp -Include *.txt -Exclude A*,c*,e*
This command lists the .txt files in the temp directory, except for those whose names start with the letter A or C
or E.
-------------------------- EXAMPLE 3 --------------------------
PS C:\\>Get-LongChildItem ????????Path C:\\windows\\System32\\WindowsPowerShell -Filter about*.txt -Recurse -Name
This command gets only the names of all Text files that begin with 'about' in the
C:\\windows\\System32\\WindowsPowerShell directory and its subdirectories.
-------------------------- EXAMPLE 4 --------------------------
PS C:\\>Get-LongChildItem ????????Path C:\\temp -Name -Directory -Recurse
This command gets only the names of all directories in the C:\\temp directory and its subdirectories.
-------------------------- EXAMPLE 5 --------------------------
PS C:\\>Get-LongChildItem -Path C:\\temp -Recurse | Where PathLength -gt 260
This command gets all files and folders recursively. The output is then piped to Where-object which displays only
those files whose length exceeds the windows API 260 character length limitation.
-------------------------- EXAMPLE 6 --------------------------
PS C:\\>Get-LongChildItem -Path D:\\Temp
Directory: D:\\Temp
Mode LastWriteTime Length Name
---- ------------- ------ ----
Directory 12/5/2016 9:44 PM 123
File 12/23/2016 2:46 PM 9491 temp.ps1
SymLink-f 12/7/2016 7:21 PM 0 MySymLinkFile.txt
SymLink-f 12/17/2016 12:38 PM 0 MySymLinkFile2.txt
SymLink-d 12/17/2016 12:47 PM symfolder1
SymLink-d 12/17/2016 12:49 PM symfolder2
File 12/25/2016 2:10 AM 4405 test.ps1
File 12/11/2016 1:52 PM 3 testfile1.txt
Directory 12/11/2016 2:26 PM testmodule
File 12/11/2016 2:02 PM 3 thirdfile.txt
The mode property now shows whether a file or folder is a symlink(symboliclink) and additionaly indicates whether
the type is a file or a directory
-------------------------- EXAMPLE 7 --------------------------
PS C:\\>Get-LongChildItem -Path D:\\Temp -SkipSymbolicLink
Directory: D:\\Temp
Mode LastWriteTime Length Name
---- ------------- ------ ----
Directory 12/5/2016 9:44 PM 123
File 12/23/2016 2:46 PM 9491 temp.ps1
File
12/25/2016 2:10 AM 4405 test.ps1
File 12/11/2016 1:52 PM 3 testfile1.txt
Directory 12/11/2016 2:26 PM testmodule
File 12/11/2016 2:02 PM 3 thirdfile.txt
lists all items in d:\\temp with the exception of symboliclinks
-------------------------- EXAMPLE 8 --------------------------
PS C:\\temp>Get-LongChildItem testdir
gets items from the folder 'testdir' located in c:\\temp
RELATED LINKS