Questions tagged [get-childitem]

Get-ChildItem is a powershell cmdlet that gets the items and child items in one or more specified locations.

Get-ChildItem is a powershell cmdlet that gets the items and child 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.

A location can be a file system location, such as a directory, or a location exposed by a different Windows PowerShell provider, such as a registry hive or a certificate store.

Output

  • System.Object
    The type of object that Get-ChildItem returns is determined by the objects in the provider drive path.

  • System.String
    If you use the Name parameter, Get-ChildItem returns the object names as strings.

520 questions
0
votes
1 answer

Android list view returns null value for getChildAt()

Hi I am developing small android application in which I want to get child at particular position in my list view.But it gives null value for me. My list and data provided to list view is proper because its working fine. But I am not able to get…
nilkash
  • 7,408
  • 32
  • 99
  • 176
0
votes
1 answer

rename file with add length (in bytes) power shell

i have a problem : in files name i have to write their lengths for example qwerty.tmp → qwerty_12039.tmp ! please help use: get-childitem c:\Folder | rename-item -NewName {$_.name -replace ".tmp", $_length ".tmp"} but it doesn't work
Vladimir Voitekhovski
  • 1,472
  • 5
  • 21
  • 33
0
votes
3 answers

Powershell path not taking string variable

I am using the following code to select a folder through the Windows Forms "Browse" function and then pass that path to the gci cmdlet cls Function Get-Directory($initialDirectory) { …
PickyTech
  • 135
  • 3
  • 9
0
votes
1 answer

is get-childItem's new -file parameter fast like -filter or slow like -include?

EDIT Hoping here to clarify my convoluted and misleading question... based on my mistaken assumption that -file accepts inputs. Thanks for setting me straight and pointing out that it's just a switch parameter; the inputs in my example actually get…
noam
  • 1,914
  • 2
  • 20
  • 26
0
votes
1 answer

powershell Get-ChildItem iis:\sites | Export_CliXml sites.xml doesn't result in same as string output

Short: Get-ChildItem IIS:\Sites Get-ChildItem IIS:\Sites | Get-CliXml sites.xml returns one thing as string and another as xml. Why? Longer: When I run Get-ChildItem IIS:\Sites I get something in the line of Name ID State …
LosManos
  • 7,195
  • 6
  • 56
  • 107
0
votes
2 answers

How to judge certain type of files(suce as csv file) exist using powershell?

I need a function to delete all the csv files in a folder A, if there is csv files in folder A , then delete all the csv files(actually, I don't know the exact csv files' name in folder A); if there is no csv file in folder A , then do nothing. I…
CharlieShi
  • 888
  • 3
  • 17
  • 43
-1
votes
1 answer

Cannot output file info with get-childitem when using variable for computer name

I am trying to read a list of computers from a .txt file, then look for a specific file named engage.* that exists in a specific directory on the pcs, then output the file info for engage.* to a csv file. However, when using the $computer variable…
EBoone
  • 9
  • 1
-1
votes
1 answer

Reorganise folders

I have a folder with many subfolders (subfolder1). Under each subfolder1 is another subfolder (subfolder2) containing files. I want to remove the first level of subfolder1 so that all I have is subfolder2 and subfolder2s contents. So I guess it…
Martina
  • 3
  • 2
-1
votes
1 answer

Get-ChildItem Confusing Results

I'm running Get-ChildItem but its returning TWO results which is confusing me ... why ? Get-ChildItem "$env:ProgramFiles\Google\Drive File Stream\" -Filter 'GoogleDriveFS.exe' -Recurse here's the output: Directory: C:\Program Files\Google\Drive…
Tony
  • 8,681
  • 7
  • 36
  • 55
-1
votes
1 answer

Posh-SSH PowerShell How to get filename and status, and add line to log file

Im trying copy file to SFTP server i use posh shh and if it was successfully moved then I get the filename and add new line in Log file, otherwise i add line that file wasnt move or file not in source dir. I understand how to copy and add line into…
-1
votes
1 answer

Get-child with wildcards in the name

I'm trying to use get-childitem to search all directories with name like "temp","temp2","temp3".... How can I assume to use wildcard to search directories names? Thanks all.
-1
votes
1 answer

PowerShell one line command to display names of local git repositories

I'm trying to write a simple command that will show me where all the git repositories are on my local disk. The following command get-childitem -path d:\ .git -recurse -directory -hidden displays all the desired information, but also displays the…
jkozma
  • 3
  • 3
-1
votes
3 answers

Unable to get filename using Get-ChildItem with PowerShell

I am checking each folder for an HTMLreports directory and then deleting files that are over 30 days old. But when it gets to the filename for $document.Name or $image.name in the foreach loop it is not getting the filename to delete the file for…
Peter G
  • 93
  • 1
  • 4
  • 11
-1
votes
1 answer

Substring Function don't work with a variable

I need the first 3 bytes of a string. My code gets an error. # This Code don't work $folderoutput="Z:\Home\Chronos\" + $datum.Month; $test = Get-ChildItem -Path $folderinput| select name, state -last 1 $test.Substring(0,3) # This Code…
-1
votes
1 answer

Is there a way to store Get-ChildItem object in variable

I am trying to do next: $a = $(Get-ChildItem -Path path | Select-Object -Property creationtime, name, size ) $a.Name $a.CreationTime $.Size I am getting an error. When I select single attribute - no problem. Is there a way to select whole object…
gene golub
  • 51
  • 3
  • 7
1 2 3
34
35