 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
SKAN
Joined: 26 Dec 2005 Posts: 6264
|
Posted: Sun Apr 02, 2006 5:50 am Post subject: |
|
|
| BoBo wrote: | | Code: | RunWait, cmd /c Copy file1.jpg C:\temp,, Hide
RunWait, cmd /c Copy file2.jpg C:\temp,, Hide | Isn't that OK for you ? |
Dear BoBo,
I already tried this .. I am not sure what is happening.. But Windows notifies the DOS command that the file has been copied (well before it is fully copied!) and windows continues the "copy process" in background..
This works :
| Code: | FileName = C:\image.dat
Target = C:\Temp
FileCopy, %FileName%, %Target%
Loop,
{
FileGetSize, UnUsedVar, %Target%\%FileName%
If errorlevel = 0
Break
} |
The loop will not break until the file has been fully written.
BTW, I like the way you envision ..
Thanks. Regards,  _________________
 |
|
| Back to top |
|
 |
PhiLho
Joined: 27 Dec 2005 Posts: 6721 Location: France (near Paris)
|
Posted: Sun Apr 02, 2006 6:37 am Post subject: |
|
|
Interesting trick. I suppose that if the file is copied, it is locked, so FileGetSize fails. I would add a small sleep in the loop to avoid slowing down the system (perhaps).
Somebody else has a similar problem (creating a PDF file) and I recommended to do a loop reading a few bytes with my binary reading routine, but now I will first recommand your method.
Otherwise, if you don't mind using a third party software, I think that XXCOPY or TotakCopy do the copy "by hand", so can reliably tell when the copy is over. _________________
vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2") |
|
| Back to top |
|
 |
SKAN
Joined: 26 Dec 2005 Posts: 6264
|
Posted: Sun Apr 02, 2006 1:26 pm Post subject: |
|
|
Dear PhiLho,
| Quote: | | Interesting trick. |
Credit: Serenity's post
| Quote: | | I suppose that if the file is copied, it is locked, so FileGetSize fails. I would add a small sleep in the loop to avoid slowing down the system (perhaps). |
Good Info ... Thanks
| Quote: | | Somebody else has a similar problem (creating a PDF file) and I recommended to do a loop reading a few bytes with my binary reading routine, but now I will first recommand your method. |
I request you to you write a FileCopy() command with your Binary Functions.
- We can have a nice Progress bar included.. (very useful for transferring Large files)
- We can have built-in support for CRC32
FileCopy("C:\Temp.Mpg","D:\Temp.Mpg") will copy and name the Target file something like
[CRC32-37ab425ef] Temp.mpg
Etcetera...
| Quote: | | Otherwise, if you don't mind using a third party software, I think that XXCOPY or TotakCopy do the copy "by hand", so can reliably tell when the copy is over. |
XXCopy looks promising.. Yet to download & try it!
Regards,  _________________
 |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|