file-copying

CopyFileEx with multiple files, but only one copy dialog

你。 提交于 2019-12-01 06:53:40
I've searched the web and stackoverflow for this. I want to copy multiple files from multiple sources to multiple destinations. I don't bother with UnauthorizedAccessExceptions yet - the files are most likely to not be in use anyway. I can copy 1 file using CopyFileEx-Wrapper from here . However: I'd like the standard windows copy file dialog to appear. And I'd like to copy multiple files - not just one - by e.g. passing an array of source files and an array of destination files. Is there a way to do this? Further more: is there a way to queue this as one task and not x separated copy

How do I invoke the shell “file copy dialog” to report the progress of a copy in Win32?

本秂侑毒 提交于 2019-11-30 19:08:45
问题 How can I copy files by invoking windows "copy files" dialog to do it? SHFileOperation seems like a option, but it is inside our process. By the way, does SHFileOperation have GUI interface? Is it exactly the same as the Windows copy dialog? 回答1: Yes, this is what the SHFileOperation function is designed for. It accepts an SHFILEOPSTRUCT structure as its only parameter, which you can use to specify the options that you want. However, it has been replaced in Windows Vista and later versions

How to use copyfile when there are spaces in the directory name?

喜欢而已 提交于 2019-11-30 15:35:44
I am trying to perform a simple file copy task under Windows and I am having some problems. My first attempt was to use import shutils source = 'C:\Documents and Settings\Some directory\My file.txt' destination = 'C:\Documents and Settings\Some other directory\Copy.txt' shutil.copyfile(source, destination) copyfile can't find the source and/or can't create the destination. My second guess was to use shutil.copyfile('"' + source + '"', '"' + destination + '"') But it's failing again. Any hint? Edit The resulting code is IOError: [Errno 22] Invalid argument: '"C:\Documents and Settings\Some

How to copy file from local system to other system in C# (windows app)?

时光总嘲笑我的痴心妄想 提交于 2019-11-30 13:52:52
I need to load help files from my windows C# application and move/copy to other system (to its local drive). Application (same C# windows application) on the local system will use it for help. What needs to be done to accomplish this? I understand File.Copy() but i don't know, will it hold for remote system also? jerryjvl File.Copy( @"C:\localpath\file.hlp", @"\\remotemachinename\localpathonremotemachine\file.hlp"); Or something along those lines... the second value is a UNC path. And in case the target location needs a login and password, the following answer is applicable: Copy file to

Copy a file without using the windows file cache

孤者浪人 提交于 2019-11-30 10:03:39
Anybody know of a way to copy a file from path A to path B and suppressing the Windows file system cache? Typical use is copying a large file from a USB drive, or server to your local machine. Windows seems to swap everything out if the file is really big, e.g. 2GiB. Prefer example in C#, but I'm guessing this would be a Win32 call of some sort if possible. Even more important, there are FILE_FLAG_WRITE_THROUGH and FILE_FLAG_NO_BUFFERING. MSDN has a nice article on them both: http://support.microsoft.com/kb/99794 In C# I have found something like this to work, this can be changed to copy

How to know that File.Copy succeeded?

给你一囗甜甜゛ 提交于 2019-11-30 08:55:38
问题 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 condition. Something like this: if(no exception happened){ //my code goes here } Edit: I have solved the problem using a simple counter as following: int i=0; try{ File.Copy(); } catch(e1){ i++; } catch(e2){ i++; } if(i==0){ //my code goes here } Thanks

How to use copyfile when there are spaces in the directory name?

烈酒焚心 提交于 2019-11-29 21:54:16
问题 I am trying to perform a simple file copy task under Windows and I am having some problems. My first attempt was to use import shutils source = 'C:\Documents and Settings\Some directory\My file.txt' destination = 'C:\Documents and Settings\Some other directory\Copy.txt' shutil.copyfile(source, destination) copyfile can't find the source and/or can't create the destination. My second guess was to use shutil.copyfile('"' + source + '"', '"' + destination + '"') But it's failing again. Any hint?

Calculating Time Remaining on File Copy

杀马特。学长 韩版系。学妹 提交于 2019-11-29 14:53:44
问题 I have an app that copies a large amount of files across the network to a file server (not web). I am trying to display a half decent estimation of the time remaining. I have looked at a number of articles on SO an while the problem is addressed none that I have tried really do what I want. I want the estimated time remaining to be relatively stable I.E. not jump around all over the place depending on fluctuating transfer speeds. So the first solution I looked at was to calculate the transfer

Copy a file without using the windows file cache

◇◆丶佛笑我妖孽 提交于 2019-11-29 14:39:58
问题 Anybody know of a way to copy a file from path A to path B and suppressing the Windows file system cache? Typical use is copying a large file from a USB drive, or server to your local machine. Windows seems to swap everything out if the file is really big, e.g. 2GiB. Prefer example in C#, but I'm guessing this would be a Win32 call of some sort if possible. 回答1: Even more important, there are FILE_FLAG_WRITE_THROUGH and FILE_FLAG_NO_BUFFERING. MSDN has a nice article on them both: http:/

How to know that File.Copy succeeded?

▼魔方 西西 提交于 2019-11-29 09:15:22
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 condition. Something like this: if(no exception happened){ //my code goes here } Edit: I have solved the problem using a simple counter as following: int i=0; try{ File.Copy(); } catch(e1){ i++; } catch(e2){ i++; } if(i==0){ //my code goes here } Thanks for all contributors. I will go through your answers to choose the best. If the operation doesn't throw