Opened 18 years ago
Closed 18 years ago
#170 closed Bug (No Bug)
FileCopy unable to copy new files when source files number excess 10k
| Reported by: | anonymous | Owned by: | |
|---|---|---|---|
| Milestone: | Component: | AutoIt | |
| Version: | 3.2.10.0 | Severity: | |
| Keywords: | Cc: |
Description
When using filecopy with wildcard, like
FileCopy ("X:\*.bin", "C:\Program Files\test")
If source folder contains more than 10000 files, it will run but wouldn't copy any files to the target folder.
Attachments (0)
Change History (7)
comment:1 by , 18 years ago
comment:3 by , 18 years ago
| Resolution: | → No Bug |
|---|---|
| Status: | new → closed |
comment:4 by , 18 years ago
| Resolution: | No Bug |
|---|---|
| Status: | closed → reopened |
Here is my test code
$SourceDir="i:\temp\test1"
$TargetDir="i:\temp\test2"
DirCreate($SourceDir)
DirCreate($TargetDir)
FileChangeDir($SourceDir)
For $x = 1 To 13005
;FileWriteLine($x & ".txt",$x)
Next
FileCopy($SourceDir&"\*.*",$TargetDir&"\*.*",0)
$x+=1
FileWriteLine($x & ".txt",$x)
FileCopy($SourceDir&"\*.*",$TargetDir&"\*.*",0)
$FileCnt = DirGetSize($SourceDir,1)
ConsoleWrite(" Files in " & $SourceDir & ": " & $FileCnt[1] & @CRLF)
$FileCnt = DirGetSize($TargetDir,1)
ConsoleWrite(" Files in " & $TargetDir & ": " & $FileCnt[1] & @CRLF)
Ooops! The new files aren't copied!
>Running:(3.2.10.0):E:\Program Files\AutoIt3\autoit3.exe "I:\temp\test.au3" Files in i:\temp\test1: 13006 Files in i:\temp\test2: 13005
comment:5 by , 18 years ago
Well, the error is really quite obvious. You created 13,005 files, copied them all, then created 1 more file and told FileCopy() to copy all the files again but did not specify the overwrite flag. FileCopy() stops on the very first file because it's not allowed to overwrite. This is obviously not quite expected (or documented) behavior but I'm certain that it is no bug, either.
follow-up: 7 comment:6 by , 18 years ago
But I think we expect FileCopy() will "copy all new files and skip existing files".
comment:7 by , 18 years ago
| Resolution: | → No Bug |
|---|---|
| Status: | reopened → closed |
Replying to Nitrogen:
But I think we expect FileCopy() will "copy all new files and skip existing files".
Filecopy is doing what Windows does and stop when Windows stop.
You cannot expect such behavior
I will close again

This script runs fine for me:
DirCreate("C:\temp\test1") FileChangeDir("C:\temp\test1") For $x = 1 To 10005 FileWriteLine($x & ".txt",$x) Next FileCopy("C:\temp\test1\*.*","C:\temp\test2\*.*",1+8) $FileCnt = DirGetSize("C:\temp\test2",1) ConsoleWrite(" Files in C:\temp\test2:" & $FileCnt[1] & @CRLF)It creates 10005 files in a directory and then copies them to a new directory.
Are you sure that none of the files is in use since FileCopy will stop processing when that happens.
Autoit3:3.2.10.0 Environment(Language:0409 Keyboard:00000409 OS:WIN_XP/Service Pack 2 CPU:X86)