file-copying

How does one display progress of a file copy operation in Java. without using Swing e.g. in a Web app?

无人久伴 提交于 2019-12-21 02:56:08
问题 I have a web application which needs to perform a file copy operation and show user a progress bar. Currently, the copy is being done by calling cpio which cannot give progress to the Java code until after the operation has completed. While it would be possible to use Java to monitor the number of bytes written vs. number of bytes read for an estimate of the copy progress, I think there might be a simpler solution if I code the actual copy operation in Java. I would still use cpio for

How can I limit the cache used by copying so there is still memory available for other cache?

ぐ巨炮叔叔 提交于 2019-12-20 17:29:10
问题 Basic situation: I am copying some NTFS disks in openSuSE. Each one is 2TB. When I do this, the system runs slow. My guesses: I believe it is likely due to caching. Linux decides to discard useful cache (eg. kde4 bloat, virtual machine disks, LibreOffice binaries, Thunderbird binaries, etc.) and instead fill all available memory (24 GB total) with stuff from the copying disks, which will be read only once, then written and never used again. So then any time I use these apps (or kde4), the

Permission denied on CopyFile in VBS

…衆ロ難τιáo~ 提交于 2019-12-17 16:31:56
问题 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 contents using the same source and destination directories, and they work perfectly. It's only when I use CopyFile that it fails. Dim fso Set fso = CreateObject("Scripting.FileSystemObject") If Not fso.FileExists("H:\Minecraft\.minecraft\options.txt")

Copying raw file into SDCard?

谁说我不能喝 提交于 2019-12-17 06:51:58
问题 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? 回答1: Read from the resource, write to a file on the SD card: InputStream in = getResources().openRawResource(R.raw.myresource); FileOutputStream out = new FileOutputStream(somePathOnSdCard); byte[] buff = new byte[1024]; int read = 0; try { while ((read = in.read(buff)) > 0) { out.write(buff, 0, read); } } finally { in.close();

How to bring up the built-in File Copy dialog?

笑着哭i 提交于 2019-12-17 06:46:23
问题 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 also need a "Copy complete" and "Copy failed" notification. I need this to work on Windows XP, Vista and 7. Is there a way to call to engage this functionality from my c# code? 回答1: Answer taken from: here Windows Vista does indeed include a new

Copying one file to another(Unix/C)?

这一生的挚爱 提交于 2019-12-14 04:12:05
问题 I have written the following code to copy one file to another. Although the code works, the code still prints both error messages. Why is this ? I am a complete beginner to Unix and C programming(although I have worked with C++ before), so any help in as much detail as possible would be great. Thanks ! int main(int argc, char *argv[]) { int n; char buf[4096]; while ((n=read( open(argv[1], O_RDONLY) , buf, 4096))>0) { if (write(creat(argv[2], S_IREAD | S_IWRITE ), buf, n)!=n) printf("Error

How to copy a file to portable drive root with cocoa?

陌路散爱 提交于 2019-12-13 17:35:06
问题 I've tried the following [[NSFileManager defaultManager] copyItemAtPath:@"whatever.txt" toPath:@"/Volumes/MyDrive" error:&copyError]; This gives me the error "The operation couldn’t be completed. File exists" If I try to copy it to "/Volumes/MyDrive/testFolder" everything copies to testFolder just fine. 回答1: I've tried the following [[NSFileManager defaultManager] copyItemAtPath:@"whatever.txt" toPath:@"/Volumes/MyDrive" error:&copyError]; This gives me the error "The operation couldn’t be

Editing a line in a text file using temp file C

痞子三分冷 提交于 2019-12-13 07:08:02
问题 I am trying to edit a line in a textfile but i have an unexpected behavior while i am editing the file. What i want to do is adjust a specific line (points : 100) of a text that looks like. In the function i pass arguments by value the new coins to be adjusted and the offset of the file with ftell->user_point. What i get as an output is weird. I try to copy the rest of the file to a temp,with an edited line, and then copy it back to the original file from the point that i copied to temp.

File Copy Tool w/ Producer/Consumer Model

眉间皱痕 提交于 2019-12-13 05:24:03
问题 so I was looking over my next school assignment, and I'm baffled. I figured I would come to the experts for some direction. My knowledge on synchronization is severely lacking, and I didn't do so hot on the "mcopyfile" assignment it refers to. Terrible would probably be a good word for it. If I could get some direction on how to accomplish this problem, it would be much appreciated. Not looking for someone to do my assignment, just need someone to point me in the right direction. baby steps.

Hook into the Windows File Copy API from C++

拜拜、爱过 提交于 2019-12-12 12:33:45
问题 I need to hook copyfile in order to stop the process whenever a malicious file is being copied. I saw a question asked by Cat Man Do Hook into the Windows File Copy API from C# and he mentioned that there is a solution for this problem in c++. I am using embarcadero c++ builder(non-MFC). Is this solution applicable for c++ builder and if it is can anybody post the link or give me a hint on how to hook copyfile in c++? 回答1: You're not being specific about what you mean by "stop the process" -