The filesystem operation whereby the contents of a disk file are duplicated exactly and stored in a different location. Questions concerning non-filesystem methods (e.g. using stdin and stdout) of file duplication are also acceptable.
Questions tagged [file-copying]
735 questions
3702
votes
21 answers
2770
votes
27 answers
Copying files from Docker container to host
I'm thinking of using Docker to build my dependencies on a Continuous Integration (CI) server, so that I don't have to install all the runtimes and libraries on the agents themselves.
To achieve this I would need to copy the build artifacts that…

user2668128
- 39,482
- 8
- 27
- 34
156
votes
28 answers
Command copy exited with code 4 when building - Visual Studio restart solves it
Every now and then when I build my solution here (with 7 projects in it) I get the dreaded 'Command copy exited with code 4' error, in Visual Studio 2010 Premium ed.
This is because of the post-build event not being able to go through.
Here's what…

Martin S Ek
- 2,043
- 2
- 16
- 22
67
votes
5 answers
Moving files between folders
I want to copy/paste a file from one folder to another folder in windows using R, but it's not working. My code:
> file.rename(from="C:/Users/msc2/Desktop/rabata.txt",to="C:/Users/msc2/Desktop/Halwa/BADMASHI/SCOP/rabata.tx")
[1] FALSE

Sagar Nikam
- 1,708
- 3
- 22
- 35
45
votes
7 answers
How to copy a file while it is being used by another process
Is it possible to copy a file which is being using by another process at the same time?
I ask because when i am trying to copy the file using the following code an exception is raised:
System.IO.File.Copy(s, destFile, true);
The exception raised…

Vir
- 1,294
- 1
- 13
- 23
44
votes
7 answers
Java 8: Copy directory recursively?
I see that Java 8 has significantly cleaned up reading the contents of a file into a String:
String contents = new String(Files.readAllBytes(Paths.get(new URI(someUrl))));
I am wondering if there is something similar (cleaner/less code/more…

smeeb
- 27,777
- 57
- 250
- 447
40
votes
8 answers
Permission denied on CopyFile in VBS
I'm trying to automate pushing a file into my users' home directories, but am stuck on a "Permission Denied" error — is thrown on line 6 here, with the CopyFile call.
There are other parts of the script (not shown) that create and copy folder…

Triz
- 757
- 2
- 10
- 19
38
votes
6 answers
File Copy with Progress Bar
I used this code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Windows.Forms;
using System.IO;
namespace WindowsApplication1 {
public partial class Form1 : Form {
// Class to report progress
…

patlimosnero
- 963
- 4
- 13
- 22
30
votes
4 answers
How to Copy Files Fast
What is the fastest way to copy files in a python program?
It takes at least 3 times longer to copy files with shutil.copyfile() versus to a regular right-click-copy > right-click-paste using Windows File Explorer or Mac's Finder.
Is there any…

alphanumeric
- 17,967
- 64
- 244
- 392
28
votes
2 answers
How to bring up the built-in File Copy dialog?
I'll be copying a large file over the network using my winforms app and I need to show some kind of progress bar. Rather than cook up my own copy routine, I was thinking that it might be better to simply show the built-in file copy dialog.
I would…

AngryHacker
- 59,598
- 102
- 325
- 594
27
votes
4 answers
Copy file even when destination exists (in Qt)
In the QFile::copy documentation it says
If a file with the name newName already exists, copy() returns false
(i.e., QFile will not overwrite it).
But I need to copy a file even if the destination exists. Any workaround available in Qt for…

sashoalm
- 75,001
- 122
- 434
- 781
26
votes
4 answers
Copy a file from one location to another in Python
I have a list called fileList containing thousands of filenames and sizes something like this:
['/home/rob/Pictures/some/folder/picture one something.jpg', '143452']
['/home/rob/Pictures/some/other/folder/pictureBlah.jpg',…

robster
- 626
- 1
- 7
- 22
26
votes
8 answers
How can I limit the cache used by copying so there is still memory available for other caches?
Basic situation:
I am copying some NTFS disks in openSUSE. Each one is 2 TB. When I do this, the system runs slow.
My guesses:
I believe it is likely due to caching. Linux decides to discard useful caches (for example, KDE 4 bloat, virtual machine…

Peter
- 3,067
- 2
- 17
- 18
24
votes
3 answers
Copying raw file into SDCard?
I've some audio files in my res/raw folder. For some reasons, i want to copy this files to my SDCard When, my application starts.
How can i done this? Anyone guide me?

Praveenkumar
- 24,084
- 23
- 95
- 173
23
votes
5 answers
Why does kubectl cp command terminates with exit code 126?
I am trying to copy files from the pod to local using following command:
kubectl cp /namespace/pod_name:/path/in/pod /path/in/local
But the command terminates with exit code 126 and copy doesn't take place.
Similarly while trying from local to pod…

kkpareek
- 450
- 1
- 5
- 15