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
17
votes
5 answers
How to know that File.Copy succeeded?
The static method File.Copy(String, String) doesn't return a value. How can I know programatically if that function succeeded or not ? If there is no thrown exception, File.Copy goes well. But I am asking about how to put "no exception" as a…

Aan
- 12,247
- 36
- 89
- 150
17
votes
4 answers
How do I copy a remote image in python?
I need to copy a remote image (for example http://example.com/image.jpg) to my server. Is this possible?
How do you verify that this is indeed an image?
user166648
16
votes
3 answers
How to copy a file to a specific folder in a Python script?
I have the path of a file stored in a variable (say) filePath. I would like to copy that particular file to another specific folder within a Python script.
I tried
folderPath = (os.getcwd() + "/folder_name/") #to get the path of the…

dravid07
- 437
- 3
- 6
- 16
16
votes
2 answers
Does Files.copy(Path,Path) create directories?
I have a bunch of text files(say ss1.txt,ss2.txt,ss3.txt etc.) under a directory with my Java program (C:/Users/java/dir1)?
I want to move my txt files to a new directory that hasn't been created yet. I have a String address for all of my files and…

knowads
- 705
- 2
- 7
- 24
15
votes
4 answers
What are some good approaches to predicting the completion time of a long process?
tl;dr: I want to predict file copy completion. What are good methods given the start time and the current progress?
Firstly, I am aware that this is not at all a simple problem, and that predicting the future is difficult to do well. For context,…

Cam Jackson
- 11,860
- 8
- 45
- 78
12
votes
2 answers
make an MSBuild Copy Task only copy if the source is newer regardless of size
I'm currently using an msbuild file to copy some files to the public documents folder when my EXE is compiled. My current script includes this:

Brannon
- 5,324
- 4
- 35
- 83
12
votes
3 answers
Improve speed of splitting file
I am using this code to extract a chunk from file
// info is FileInfo object pointing to file
var percentSplit = info.Length * 50 / 100; // extract 50% of file
var bytes = new byte[percentSplit];
var fileStream =…

Haris Hasan
- 29,856
- 10
- 92
- 122
11
votes
3 answers
Copy file with rsync or scp over multiple level or hops of SSH
I need to transfer around 4.2 GB of files from my local computer to a server B. However to ssh into server B, I need to ssh into server A.
Currently I'm copying files from my local computer to server A and then from server A to server B.
So the…

arpit
- 728
- 7
- 22
10
votes
2 answers
File.Copy in Parallel.ForEach
I'm trying to create a directory and copy a file (pdf) inside a Parallel.ForEach.
Below is a simple example:
private static void CreateFolderAndCopyFile(int index)
{
const string sourcePdfPath = "c:\\testdata\\test.pdf";
…

Mike
- 441
- 2
- 5
- 17
10
votes
3 answers
FileChannel.transferTo for large file in windows
Using Java NIO use can copy file faster. I found two kind of method mainly over internet to do this job.
public static void copyFile(File sourceFile, File destinationFile) throws IOException {
if (!destinationFile.exists()) {
…

Tapas Bose
- 28,796
- 74
- 215
- 331
10
votes
1 answer
How is copy paste possible?
I was wondering after using computer for a long times it feels like copy paste was fundamental feature but I know it is not. So the question is how does this really work?
I thought of all ideas how this could have been implemented but I get stuck…

Rajesh Paudel
- 1,117
- 8
- 19
10
votes
2 answers
Checking when shutil.copyfile is done
I have a such code:
for file in file_list:
shutil.copyfile(file,newpath)
#do further actions
And here is the question, at #do further actions I use the copied f iles thus I need to make sure the shutil.copyfile functions finish their task. How…

Hellnar
- 62,315
- 79
- 204
- 279
9
votes
2 answers
Copy a file with its original permissions
When using the File.Copy() method the file is copied to its new directory however it loses its original permissions.
Is there a way to copy a file so that it doesn't lose the permissions?

WeaslB
- 123
- 1
- 4
9
votes
1 answer
Delphi: CopyFileEx and Thread
I have a thread and a Progress Routine (a function) inside it (in my thread class).
I try to do this inside the thread:
CopyFileEx(pchar(ListToCopy.Strings[Loop]),pchar(TN+ExtractFileName(ListToCopy.Strings[Loop])), @ProgressRoutine, nil, nil,…

maxfax
- 4,281
- 12
- 74
- 120
9
votes
2 answers
Copy file from setup location to another location in wix on install
I have created an msi setup file which includes some files in a "Sample" folder which should be copied to a temp folder. Anybody suggest how to do this?

Sukhjeevan
- 3,074
- 9
- 46
- 89