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
-2
votes
2 answers
Why is my python script unable to copy a file which definitely exists?
Source code:
import os
import shutil
import errno
from pathlib import Path
def copyFile(src, dst, buffer_size=10485760, perserveFileDate=True):
'''
Copies a file to a new location. Much faster performance than Apache Commons due to use of…

user366312
- 16,949
- 65
- 235
- 452
-2
votes
1 answer
VBScript CopyFile with spaces
A VBScript is receiving input parameters containing spaces in both the path and filename:
SOURCE = "c:\temp\testabc"
TARGET = "F:\work\dir space"
PARM = "Test file.txt"
DEST = TARGET & "\" & PARM
'…
fso.CopyFile SOURCE, DEST
The DEST would look…

et_phonehome
- 137
- 12
-2
votes
1 answer
How to copy multiple files with CopyFile function?
Here is an example my code to copy file from src to dst:
int main() {
const wchar_t* file[3] = { L"\\abc.txt", L"\\def.txt", L"\\ghi.txt" };
for (int i = 0; i < 3; i++) {
wchar_t* src = funcA();
wchar_t* dst = funcB();
…

Biswapriyo
- 3,491
- 3
- 22
- 42
-2
votes
1 answer
copy file from a remote PC by means of Powershell using UNC path
I need a way to copy file from a remote PC to local disk using Powershell v2.0 trying with admin rights of that remote PC.
We can copy a file by means of below cmdlet:
Copy-Item -Path C:\somefile.txt -Destination c:\someotherfile.txt
But my…

Nani
- 1,148
- 3
- 20
- 35
-2
votes
1 answer
Copy a file from temp folder to a browsed location
I want to copy a zip file from temp folder to a browsed location (say Destinydirectory).
This is my code however it gives me an error:
If System.IO.Directory.Exists(My.Computer.FileSystem.CombinePath(My.Computer.FileSystem.SpecialDirectories.Temp,…

t.Chat02
- 7
- 4
-2
votes
3 answers
CopyFile fails with error code 3 (ERROR_PATH_NOT_FOUND)
So, before starting, I have been researching (not only on Stack Overflow) and I can't find a solution to my problem.
I am trying to copy a file to a certain place (and if possible, change its name at the same time I copy it) using Windows' CopyFile…

78dtat78da
- 112
- 1
- 9
-2
votes
1 answer
Cant create a handle, or handle is invalid - WinAPI (CreateFile)
This is a piece of my code:
#include
#include
#include
#include
#include
#include
int main(int argc, char * agrv[]) {
//Convert argument 2 to…

johnny bravo
- 21
- 5
-2
votes
1 answer
CopyFile doesn't work with environmental strings but works only with standard directories where files are placed. Anyway to get past this?
I want to copy a file using the CopyFile() function directly from the WinAPI.
Code works, but the file isn't copied.
Here's the code-
CopyFile("%%temp%%\\test.txt", "D:\\Tutorials\\test.txt", FALSE);
If I change the %%temp%%\\test.txt to something…

blah
- 103
- 3
- 12
-2
votes
1 answer
how copy_file function is implemented which is used in CP command
I am looking at the implementation of copy command from the link :
http://src.gnu-darwin.org/src/bin/cp/cp.c.html
And its using copy_file function at its core.
if (copy_file(curr, dne))
badcp = rval = 1;
Can someone tell me how copy_file is…

kiran bobbu
- 133
- 2
- 11
-3
votes
1 answer
how to create a program that copies specific files from one directory to another?
suppose there is a folder 'Videos' with file names 1.avi ,2.avi ,3.avi ,4.avi .. till 100.avi .
i have created a program that outputs some numbers (let's say 92 , 31 , 92 ,85, 45 ) . now i want all the files named 92.avi , 31.avi , 92.avi ,85.avi ,…

user725821
- 15
- 1
-3
votes
1 answer
Can not copy file on web page
I have a python script on web page that should open one "gnuplot.gp" file and copy its content to my "final.gp" But it does not work. I have all things set up right.
Code:
file = open('gnuplot.gp','r')
plot = file.read()
file.close()
file =…
-3
votes
2 answers
Always asking file not present in bin/debug folder
Is there any way i can take the data from the original location instead of copying the file to the bin/debug folder.
I am looking to send a file to my local printer. But my C# application is allowing to send file only when i copy the file to my…

Stacy Kebler
- 180
- 1
- 3
- 22
-3
votes
1 answer
C#: OpenFileDialog copy a file
Hi I have a button with this code:
OpenFileDialog ofd = new OpenFileDialog();
string percorso = Environment.CurrentDirectory;
percorso += @"\img\Articoli";
ofd.InitialDirectory = percorso;
ofd.Filter = "File…

user1849976
- 53
- 1
- 10
-4
votes
1 answer
How to Move the files from one directory to another directory?
Directory file name should append with current date (yyyy-mm-dd)
import shutil
import os
source = '/path/to/source_folder'
dest1 = '/path/to/dest_folder'
files = os.listdir(source)
for f in files:
shutil.move(source+f, dest1)
-5
votes
1 answer
Estimate time for copying files
I need your help on to calculating the time for copying a file(s) from PC to USB in C#.
Please help.
Thanks in advance.

Harsha
- 1,861
- 7
- 28
- 56