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

Trim special characters powershell

I'm using Get-ChildItem to find files on remote computers and piping them using Select-Object to only return the file name it finds. The problem is, it's returning @{Name=File.txt}, but I only want the file name. $TraName = Get-ChildItem \\$comp\c$\…
0
votes
1 answer

How to get child item id from the expandable list view if the child's are different layouts, while click?

I am working with custom expandable list view in android. In my expandable list view has items with linear layouts. You can find my expandable listview here. https://drive.google.com/file/d/0B2NGqFM-F0bNcUZqUlRPaUZYUjg/edit?usp=sharing In the…
0
votes
1 answer

Powershell Use Invoke-Command Session to Get-Childitem sizes on a remote computer

I am trying to use powershell to remotely access a computer and get the size of each sub-directory of a folder. I am using the script to get each of the folder sizes and it works successfully: $log = "F:\logfile.txt" $startFolder = "C:\" $colItems…
user1953964
  • 11
  • 1
  • 4
0
votes
1 answer

Powershell search subfolders for specific folder and copy

I'm trying to write a powershell scripts to search a folder and its subfolders for a specific folder from a csv file and then copy that folder elsewhere. [CmdletBinding()] Param( [Parameter(Mandatory=$True,Position=1)] [string]$filePath, …
Shawn
  • 2,356
  • 6
  • 48
  • 82
0
votes
1 answer

Powershell, Directory Verification

I am fairly new to PowerShell. I have created an exe that can be ran by a coworker that will go to 8 separate sql servers, to individual directories and check them for a list of created files. My current code checks for age less than one day and…
0
votes
2 answers

using credentials to get-childitem on other server

I'm working on a script that uses get-childitem on the other server, but need to change it so it uses credentials of the local account on the other server to do that. When I was just using Active Directory to do that, I was saving the task in our…
Michele
  • 3,617
  • 12
  • 47
  • 81
0
votes
3 answers

'Get-ChildItem -Include/-Exclude' in PowerShell doesn't filter if passed as an argument to a function

I have a problem getting a filter argument to Get-ChildItem in a function. The following works fine and displays a whole list of files: c:\temp\Get-ChildItem -Include *deleteme*.txt -Recurse Now say I have the following script #file starts…
El Toro Bauldo
  • 1,199
  • 3
  • 16
  • 26
0
votes
2 answers

Get-childitem attribute shorthand syntax options

Starting with Powershell v3.0, the following syntax is possible for Get-ChildItem: dir -af Which applies certain attribute selection criteria. By experiment, I found that it means: dir -File Which is the same as this: dir -Attributes…
Victor Zakharov
  • 25,801
  • 18
  • 85
  • 151
0
votes
3 answers

How to know which child an item is for its parent

I have a multiple choice list view and for its adapter I have designed a layout file. I have an image view in the layout and when it's clicked, I want to know what child of the list it is. I mean the child id for the its parent which is the list to…
Ali Allahyar
  • 341
  • 2
  • 11
  • 22
0
votes
1 answer

IF Get-ChildItem : Cannot find path THEN connect to other path

I am trying to figure out how to write powershell script such that if powershell cannot connect to \10.10.10.10\C$\Users, it should attempt to connect to \10.10.10.10\C$\Documents and Settings So far, I have the following code $Win32OS =…
Glowie
  • 2,271
  • 21
  • 60
  • 104
0
votes
2 answers

Get-ChildItem to find last logged on user

This post for using get-childitem to find last logged on user was quite helpful, Powershell - last logged on user - same input, different output However, I am running into some problems. I am writing the following command: Get-Childitem…
Glowie
  • 2,271
  • 21
  • 60
  • 104
0
votes
1 answer

How to restrict Array by Filename - Powershell v3

I am trying to use the GCI command to call all the files within a folder bar the ones with "december" in their name. I would also like to not call files from a subfolder called "months".
0
votes
1 answer

Powershell script to find files in restricted folders (other user folders)

I'm making a script which would search for a file. If file is found it will write txt file on server with computer's name and path where file is located. $filePath = "c:" $fileName = "somefile" $computerName = Get-Content env:computername $srvPath =…
Phoneutria
  • 351
  • 4
  • 9
  • 17
0
votes
2 answers
0
votes
2 answers

powershell update file in subfolders if it already exists

I can't believe this is as difficult as I'm finding it. I have a folder on a server share. This folder has a number of subfolder which may, or may not, contain a file I want to overwrite with a latest-version. I've done many a google search &…
ninety
  • 19
  • 6