Skip to main content
Filter by
Sorted by
Tagged with
101 votes
13 answers
197k views

Is there any way to copy a really large file (from one server to another) in PowerShell AND display its progress? There are solutions out there to use Write-Progress in conjunction with looping to ...
Jason Jarrett's user avatar
47 votes
2 answers
32k views

I am writing a script for MS PowerShell. This script uses the Copy-Item command. One of the optional arguments to this command is "-container". The documentation for the argument states that ...
Mark Meuer's user avatar
  • 7,613
38 votes
4 answers
45k views

I am using the PowerShell Copy-Item command to copy a directory with files to another location. I want to display all the files on the console that are getting copied so that I know the status of the ...
tusharmath's user avatar
35 votes
3 answers
44k views

When I run a recursive Copy-Item from a folder that has sub folders to a new folder that contains the same sub folders as the original, it throws an error when the subfolders already exist. How can I ...
user1161625's user avatar
33 votes
5 answers
75k views

I am trying to recurse through a directory and copy it from A to B. That can be done with the following: Copy-Item C:\MyTest C:\MyTest2 –recurse I want to be able though to only copy new files (ones ...
user avatar
21 votes
3 answers
58k views

I am trying to use Copy-Item from remote machine to another remote machine with the command: Copy-Item -Path "\\machine1\abc\123\log 1.zip" -Destination "\\machine2\\c$\Logs\" I am constantly getting ...
Geeth's user avatar
  • 321
19 votes
1 answer
28k views

Does the -Filter or -Include parameter work for anyone when using Powershell 3.0? I've tried both of the following commands: Copy-Item -Path c:\temp -Include "*.TXT" -Destination C:\temp2 and Copy-...
inquisitive_one's user avatar
16 votes
1 answer
34k views

The reason for switching from batch files to powershell scripts is to improve error checking of the process. Does the cmdlet for copying have advantages in this regard? If a batch file already ...
Adam's user avatar
  • 1,895
15 votes
5 answers
48k views

Why does gci $from -Recurse | copy-item -Destination $to -Recurse -Force -Container not behave in the same way as copy-item $from $to -Recurse -Force ? I think it should be the same, but somehow ...
Dejan Dakić's user avatar
  • 2,448
8 votes
2 answers
4k views

Howdy, am trying to copy a file from IE cache to somewhere else. This works on w7, but not Vista Ultimate. In short: copy-item $f -Destination "$targetDir" -force (I also tried $f.fullname) The ...
boink's user avatar
  • 81
8 votes
3 answers
28k views

I am copying files from One Windows machine to another using Copy-Item in Powershell script. But I want to wait till copy completes, Powershell Copy-Item is non-blocking call means, it just triggers ...
VarunVyas's user avatar
  • 1,465
7 votes
1 answer
500 views

Consider this directory structure: C:\temp\A\file.txt C:\temp\B If I run the command Copy-Item "C:\temp\A" "C:\temp\B\A" -Recurse -Force -ErrorAction Stop I have C:\temp\A\file.txt C:\temp\B\A\...
Tomd's user avatar
  • 203
6 votes
2 answers
26k views

I'm trying to get PowerShell to copy files from a remote computer (on which I have admin rights through AD) to the local computer. It fails in the strangest place. Here's a snippet of the script: ...
AndreasKnudsen's user avatar
6 votes
2 answers
10k views

When destination folder exists the right way of copying files is defined here Copy-Item 'C:\Source\*' 'C:\Destination' -Recurse -Force If destination folder doesn't exist, some files in the source ...
Kimi's user avatar
  • 14.2k
6 votes
4 answers
15k views

I have two machines Server A and Server B, and I want to copy all the files and folder tree from Server A to Server B using PowerShell. I have tried the command given below, but it copies only the ...
Selwyn's user avatar
  • 1,621
4 votes
2 answers
11k views

I tried to use powershell command copy-item as xcopyto copy content of one disk to another one. copy-item -Path h:\* -Destination g:\ -Recurse -Force However, I encountered the following errors: ...
Loom's user avatar
  • 10k
4 votes
1 answer
2k views

I am using a FileSystemWatcher to notify on file change, and then create a copy of that file: $watcher = New-Object System.IO.FileSystemWatcher $watcher.Path = "C:\Orders\" $watcher....
Mark Richman's user avatar
  • 29.8k
4 votes
1 answer
16k views

I have a program that copies folders and files recursively. example: Copy-Item -path "$folderA" -destination "$folderB" -recurse Sometimes the files do not copy. Is there a way to "step inside the ...
alphadev's user avatar
  • 1,679
4 votes
2 answers
2k views

During repetitive logs collection on my internal system, found strange behavior of recursive Copy-Item call Say, i have C:\Source with some files and subfolders with files. I want to copy this ...
Max Shlain's user avatar
4 votes
2 answers
13k views

I'm using powershell to copy file to a remote computer witht he following command : Copy-Item -Path [MyPath]\* -Destination \\[server]\[MyPath] -force It's working great, but sometime I'm receiving ...
Marc-André Bilodeau-Lamontagne's user avatar
4 votes
1 answer
552 views

Using the PowerShell command Copy-Item to copy files works fine locally, but when running it in a PSSession, the options -Filter, -Include and -Exclude show no effect while copying files from the ...
Rantanplan's user avatar
4 votes
1 answer
832 views

I work on a windows service application which can run scripts on a target machine. One of things I need to do is copy files over from my host machine to the target machine for different users. I have ...
Madhulika's user avatar
  • 283
4 votes
5 answers
13k views

I'm trying to use Copy-Item to copy a file to an existing folder and getting the error "Could not find part of path". I've Googled this problem for ages, but can't seem to find an answer. I altered ...
Matty W's user avatar
  • 65
3 votes
2 answers
6k views

I'm having a weird issue with using PowerShell to merge multiple csv files into one. I've done this plenty of time in the cmd prompt on in windows 7, but here the output only contains the earliest ...
MWallace's user avatar
3 votes
1 answer
3k views

I'm trying to create a script that will let me copy an item from one location to a specified location in a PowerShell script. Before it's mentioned, I know that I can put a shortcut in the Send To ...
Austin Kargl's user avatar
3 votes
1 answer
17k views

I have a text file that contains a list of files in different directories, e.g C:\FolderOne\Testing.jpg C:\FolderTwo\Test.jpg I'd like to turn those names into folders. And if two files exist in one ...
TheManBehindTheMan's user avatar
3 votes
1 answer
3k views

I am counting all files in my Pictures folder with Get-ChildItem C:\pictures -force | Group-Object extension | Sort-Object count -descending | ft count,name -auto I am then copying all my MTS-files (...
Sune's user avatar
  • 3,320
3 votes
1 answer
1k views

I used the Copy-Item command to copy a set reports to a server location. It was working fine before but recently more reports have been added to the folder and now most of the times it works fine but ...
Vanya Srivastava's user avatar
3 votes
2 answers
5k views

I am running a powershell based multithreaded application in which each thread (.net task) needs to copy a bunch of files from one machine to another with a different credential. This is the script ...
Madhulika's user avatar
  • 283
3 votes
1 answer
1k views

I'm still a bit of a newbie at powershell (coming from vbscript) and it has been a while since I have done anything too serious, so I apologise in advance if the code isn't as graceful as it could be. ...
Pazu's user avatar
  • 31
2 votes
2 answers
9k views

I have a file named Data.plist in my main bundle (at the root of the app directory), and I am trying to copy this file to user document directory for read and write operations, however, I got the ...
TonyW's user avatar
  • 19k
2 votes
2 answers
9k views

My script keeps bugging me with the following exception copy-item : Cannot find drive. A drive with the name 'F' does not exist. At C:\Program Files (x86)\CA\ARCserve Backup\Templates\RB_Pre_Process....
Matthias Güntert's user avatar
2 votes
4 answers
4k views

I have a script which moves files with a specific extension from a source directory to a destination directory. My source directory looks like: FILESFOLDER File1.td File2.td SUBFOLDER File3.td ...
Kahn Kah's user avatar
  • 1,463
2 votes
2 answers
12k views

This is driving me bananas. I am assuming I am missing something stupid, but I have tried about 10 different formats and nothing works. This is the code I am running: $today=$(Get-Date -Format o) $...
Webtron's user avatar
  • 473
2 votes
1 answer
4k views

I must copy a file names as follow $filename = "Sport.EL#15.csv.[]" into another folder. if I use copy-item -force Sport.EL#15.csv.[] $dest_path it doesn't work. since I do that: foreach ...
rschirin's user avatar
  • 2,049
2 votes
2 answers
1k views

Because the -Exclude parameter of Get-ChildItem is not filtering on subfolders when using the -Recurse flag, see among other unable-to-exclude-directory-using-get-childitem-exclude-parameter-in- ...
Bartel's user avatar
  • 198
2 votes
4 answers
19k views

Following is the exact scenario in my powershell script. $Source = "C:\MyTestWebsite\" $Destination = "C:\inetpub\wwwroot\DemoSite" $ExcludeItems = @(".config", ".csproj") Copy-Item "$Source\*" -...
Nirman's user avatar
  • 6,833
2 votes
1 answer
4k views

Given the dir structure: x\Code x\Script\Backup.ps1 Backup.ps1 contains: $BackupDirectoy = "..\Backup" $CodeDirectory = "..\Code" function BackupCurrentVersion() { New-Item $...
Victor Hurdugaci's user avatar
2 votes
1 answer
3k views

This article shows how to use Invoke-Async in PowerShell: https://sqljana.wordpress.com/2018/03/16/powershell-sql-server-run-in-parallel-collect-sql-results-with-print-output-from-across-your-sql-farm-...
AlexFielder's user avatar
2 votes
1 answer
73 views

I am quite new to PowerShell. I have created a PowerShell script which identifies a specific Mp3 file out of a large number of very similar files in one folder based on certain criteria: Is the most ...
IanB's user avatar
  • 271
2 votes
1 answer
3k views

I'm trying to copy all of the cover.jpg files in my music library to one folder. My attempts so far have either landed me with one file in the destination, or every desired file but also in their own ...
Jibatsu's user avatar
  • 57
2 votes
2 answers
276 views

After searching for a wile I need to post my question here: I want to do a simple task: copy-item -path "C:\Folder Copied" -destination "C:\Folder Copied_New" -recurse Assuming ...
Adis1102's user avatar
  • 222
2 votes
2 answers
4k views

Off the back of this thread: Copy-item using invoke-async in Powershell I have the following: @mklement0's method (Copied from and amended by from here) works, but because it creates a thread per-...
AlexFielder's user avatar
2 votes
1 answer
154 views

Assuming that "C:\Temp\first.txt" is a file, is there some way to ensure that Copy-Item -Path "C:\Temp\first.txt" -Destination "C:\Temp\second.txt" creates file "C:\Temp\second.txt", or else fails? ...
H6M6's user avatar
  • 31
2 votes
2 answers
9k views

I'm having a little trouble finishing a powershell script. I have a program that downloads images into a temporary folder, then within an hour it will delete the image files. Occasionally I would ...
RayD's user avatar
  • 85
2 votes
1 answer
9k views

I have the following Powershell code: Enter-PSSession -ComputerName test01 New-PSDrive -Name Source -PSProvider FileSystem -Root \\test02\SMBTest -Credential test\Administrator Copy-Item Source:\...
boomcubist's user avatar
2 votes
3 answers
8k views

I am trying to copy some files and folder from my local machine to a remote server: Copy-Item .\copy_test.txt -destination "\\serverip\c$\backups\" but I'm getting an error: Copy-Item : Logon ...
Robert's user avatar
  • 11k
2 votes
1 answer
2k views

I know how to do it with different commands but is there a way to make it so copy-item cmdlet also copies directories to the target folder for example if I wanted to copy everything in the C:\users ...
user1553612's user avatar
2 votes
1 answer
364 views

I am getting all wav files in the past 24 hours from one folder and putting them in another folder. I swear this worked for me a bit ago and wanted to add in some more conditional statements but now ...
robertuxo's user avatar
2 votes
1 answer
14k views

I'm doing a few small school assignments, but our teacher is doing a pretty bad job in explaining stuff, so I've basically just been googling watching videos etc. But I have to make a script that ...
lanes55's user avatar
  • 21

1
2 3 4 5 6