Questions tagged [copy-item]

Copy-Item is a powershell cmdlet that copies an item from one location to another.

Copy-Item is a powershell cmdlet that copies an item from one location to another in the same namespace. For example, it can copy a file to a folder, but it cannot copy a file to a certificate drive.

Copy-Item does not cut or delete the items being copied. The particular items that the cmdlet can copy depend on the Windows PowerShell provider that exposes the item. For example, it can copy files and directories in a file system drive and registry keys and entries in the registry drive.

Copy-Item can copy and rename items in the same command. To rename an item, enter the new name in the value of the Destination parameter. To rename an item without copying it, use the Rename-Item cmdlet.

Output

  • None or an object representing the copied item.
    When you use the PassThru parameter, Copy-Item returns an object that represents the copied item. Otherwise, this cmdlet does not generate any output.
282 questions
0
votes
1 answer

Powershell to copy some specific files and some subfolders to destination

I have a folder source. It has the following files: image_00000.jpg ... ... image_08000.jpg And some subfolders which have Negatives appended at the end: My goal is to copy specific files say from, everything except image_00000.jpg to…
Manish Kumar Sharma
  • 12,982
  • 9
  • 58
  • 105
0
votes
0 answers

Power Shell - Copy-Item UNC Path, Cannot Find Path... Does not Exist

I am having an issues with copying an item to a remote computer. I am using credentials for a domain admin to push remote installs. I am able to run this file locally however trying to push MSI file from a remote location it errors out. So i wanted…
0
votes
1 answer

powershell copy files recursively excluding those that exist in a list

I have a file (e.g. list.txt) with list of paths of files e.g. F:\users\user\desktop\f1.doc F:\users\user\desktop\f2.doc F:\users\user\documents\f3.doc F:\users\user\documents\f4.doc I also have attached to my computer an F: drive that has these and…
Kamal
  • 383
  • 1
  • 6
  • 16
0
votes
1 answer

How I can use a Powershell Script for copy data from position A to position B?

I want to use a Powershell script for copy a folder recursive to a other position. This must the Powershell todo: copy file and folders from position A to position B UNC PAth must have (for example \net.local\Files\EDV) On position B must all empty…
Tarasov
  • 3,625
  • 19
  • 68
  • 128
0
votes
1 answer

copy in powershell does not work as excpected

I have the following powershell script that not quite work as I thought it would. I want to copy the new created file in the source folder ($folder) to my destination folder ($DestFolder), but no file is copied. Anyone see what could be…
MTplus
  • 2,077
  • 4
  • 34
  • 51
0
votes
1 answer

Copy-Item on registry + exclude

I am having slight difficulties to copy an entire key with its contents due to REG_NONE value type not being supported by PS 2.0. $key = "HKCU:\Software\Microsoft\Office\14.0\Outlook" There is a need to copy its entire contents to a different…
dhex
  • 25
  • 5
0
votes
0 answers

How to deploy code to hundreds of servers efficiently

We have hundreds of VMs running application, and deploying code to all of them at a time is getting challenging. Deploying them sequentially using robocopy is taking hours and running them as parallel threads/jobs is taking up deployment server CPU…
user1550159
  • 1,197
  • 3
  • 19
  • 36
0
votes
2 answers

path as parameter powershell

I have problem with path. I need to copy all files from directory I add as 1st parameter in Powershell command. Now I have: Copy-Item -Path "$args[0]/" -Filter*.* So it will copy to location I am now (and it's ok, I don't want other location) but…
Roberto
  • 315
  • 1
  • 5
  • 18
0
votes
1 answer

Copy-Item works for IP address, not Computer Name

The following code will copy files to remote_computer if I use its IP address 10.10.10.10 $j = "remote_computer" New-PSDrive -Name Z -PSProvider FileSystem -Root \\$j\share -Credential $credentials -ErrorAction Stop Copy-Item -Path…
Glowie
  • 2,271
  • 21
  • 60
  • 104
0
votes
1 answer

How can I save an XML in a path with 260+ characters?

Here is my situation. I have an XML that resides in a path that contains 260+ characters. One of the folders in this path will always be random, another one is based on versions so it could be different as well. I am trying to load the XML, make…
HikerJim
  • 3
  • 2
0
votes
1 answer

recursing folders and renaming files with create date added to filename

I am very much a newbie to powershell but have figured out some of what I need for a project at work. We have test result files (PDF, XLS. TXT, etc) in folders relating to test locations. Most folders have subfolders with files. The boss has…
user3614286
  • 1
  • 1
  • 1
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 filter files by SQL Server result set and copy

I am executing a query in SQL Server and returning a single column result set. I need to loop through the result set and find file names matching the record from the result set. Part of the file name is a sequence number. I need to sort the files in…
stittdba
  • 3
  • 1
  • 4
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
0
votes
1 answer

How to mirror files with given pattern (wildcard)

I've got a folder with a lots of installation files inside. I would like to take some of these (found by given pattern) and mirror them to the flash drive.…
Joudicek Jouda
  • 792
  • 2
  • 13
  • 30
1 2 3
18
19