# Solved: Should be easy - VBScript - Loop on FileExist (multiple files needed)



## StumpedTechy (Jul 7, 2004)

I think this is a simple one - I have a directory I am copying 9 files form one dir to another I want to wait until all 9 files are copied over to the PC before the script continues This is over a WAN so the timeing is VERY diffcult to do sleep on so I figured I would do a sleep loop.

How can I make this FileExists look for 9 files without doing 9 loops?


```
Do While Not objFSO.FileExists("C:\somefile")
    Wscript.Sleep 10000
Loop
```


----------



## StumpedTechy (Jul 7, 2004)

NM I worked with someone who gave me the answer -

Path = "Directory"

Set fso = createobject("Scripting.FileSystemObject")
Set oFolder = fso.GetFolder(Path)

Do While FileCount < 9
For Each oFile In oFolder.files
FileCount = FileCount+1
Next


----------

