Archive: CopyFiles is slow, one file per second


CopyFiles is slow, one file per second
CopyFiles copies any file I have slowly, about one file every 1.1 seconds. I tried different types of examples with CopyFiles and different scripts. To duplicate the problem, try the example below and let me know what's up. Remember it creates a few temporary files in the current folder. Thanks.


!include "MUI.nsh"
OutFile "temp.exe"
ShowInstDetails show
!define MUI_FINISHPAGE_NOAUTOCLOSE
!insertmacro MUI_PAGE_INSTFILES

Function .onInit
FileOpen $1 "test0.txt" a ; create file if not exist
FileClose $1
FunctionEnd

Section "Component" Sec1
CopyFiles "test0.txt" "test1.txt"
CopyFiles "test0.txt" "test2.txt"
CopyFiles "test0.txt" "test3.txt"
CopyFiles "test0.txt" "test4.txt"
CopyFiles "test0.txt" "test5.txt"
CopyFiles "test0.txt" "test6.txt"
CopyFiles "test0.txt" "test7.txt"
CopyFiles "test0.txt" "test8.txt"
CopyFiles "test0.txt" "test9.txt"
SectionEnd

The install finishes in under a second for me. Maybe it's because I'm using a Pentium 4 machine :rolleyes:. I am using nsis 2.15. It could be just your system.


You have no problem ?

I also have a P4-3GHz machine and NSIS 2.15. Using 'File','Delete','RMDir' command is instantaneous for me, but not 'CopyFiles'. (I just realized you were being sarcastic .. :))

Time to reinstall nsis or windows if it is just my system ...

Now what worries me is that what if I gave the installation to other people and they run into this problem too. They can not be expected to reinstall windows ... ?


I don't use copy files myself, so I can't really help you. Maybe you were running harddisk/cpu intensive apps in the background.


Without it, do you have a way to make a backup of files before you extract your package?. Without it, do you have a way to be able to setup installation to copy files from CD instead of extracting? Would be nice to know an alternative.

BTW, nothing is in the background. I am not sure how else to say that only that command is slow. Using 'File' to extract 10 megabytes of files takes a few seconds. Using 'CopyFiles' would take the same process 24 minutes (1440 files). I tried deleting files before copying. I tried other drives, harddisks, network drive, usb drive.


CopyFiles /SILENT ...

OMG. It works. I would never have known that by looking at the tutorial in section 4.9.3.2. The description is completely different. Thanks Instructor.

Do I need error checking? The tutorial says error checking is turned off when using silent?

P.S. Sorry the code above saves files in 'C:\Program Files\NSIS\'. I thought it was going to the current folder and forgot to use $OUTDIR and $EXEDIR.


Function .onInit
SetOutPath "$EXEDIR"
FileOpen $1 "test0.txt" a ; create file if not exist
FileClose $1
FunctionEnd

Error flag is set if any error appeared:

Name "Output"
OutFile "Output.exe"

Section
CopyFiles /SILENT "C:\NotExisted.ext" "D:\"

IfErrors 0 +2
MessageBox MB_OK "error"
SectionEnd

Thanks. That is good news.


I don't want to create new thread, so I'll post here.

I have problem with copying (and deleting, moving, reading also) NSIS installers. It is very slow (about 300 kB/s) on my decent machine. I am using LZMA compression and my installer has about 9 MBs. By the way, compress ratio is very good (under 25%), I think that it is because I have packed 3 very similar and large binaries.


maybe you should also take as the security program that you have may decrease processor speed...mostly if you have symantec's :rolleyes:


Joel, If I have 9 MBs NSIS .exe and 9MBs zip file and try to copy them, then both copies takes same time. BUT after copying the .exe is copy progressbar on 100% for approximately 3-4 seconds. It disappears immediately when I am copying the .zip or other file. I don't understand this. I think, that it has nothing to do with security programs (I am using NOD 32 on my "NSIS" machine).


Originally posted by pospec
Joel, If I have 9 MBs NSIS .exe and 9MBs zip file and try to copy them, then both copies takes same time. BUT after copying the .exe is copy progressbar on 100% for approximately 3-4 seconds. It disappears immediately when I am copying the .zip or other file. I don't understand this. I think, that it has nothing to do with security programs (I am using NOD 32 on my "NSIS" machine).
I have a project of 100 MB of the nsis .exe.
Inside I have a 25~ MB of 7zip, 10~MB of zip, plus files inside, and some files are in $EXEDIR of my CD-ROM.
The only problem, if that is a problem, is when nsis dump all to $PLUGINSDIR...but decompressing the single files aren't for me one per sec, even I use nod32 3.x beta...
Normally nod32 scans in each file compress, so maybe id your memory, processor...don't know...I've using nsis since 1.98 as far I remember, and trust me...hog isn't part of its specs.

I think that you don't understand me. If I say COPYING, DELETING, MOVING, then I mean operations done by my OS, not by NSIS. I compared copying 9MBs NSIS .exe and 9MBs .zip FROM ONE FOLDER TO ANOTHER in my previous post.
I know that it was confusing to post this here to this thread, but I didn't want to start a new one. Maybe I had to...
So, I am just curious why system waits ~4 seconds after copying NSIS .exe file and doesn't wait after copying another one. If I close NOD32 it happens too.