vbs : how to wait for the end of the copy execution

Asked

Viewed 33 times

1

In the following programme on VBScript I try to copy a group of files (in fileCollection) to an already created zip file:

Set FSO = CreateObject("Scripting.FileSystemObject")'Reference the Text directory
Set SAPP = CreateObject("Shell.Application")
Set StdOut = FSO.GetStandardStream (1)
...
zipFile = FSO.GetAbsolutePathName(zipFile)

For Each file in fileCollection
  StdOut.WriteLine("- " & FSO.GetAbsolutePathName(file))
  SAPP.NameSpace(zipFile).CopyHere(FSO.GetAbsolutePathName(file))
Next

However, this script completes itself before all files are in zip file... Even with WScript.Sleep(15*1000) script does not complete execution (I have 23 files and 750 K to compress)...

My questions are:

How to wait for the copy to be complete before finishing the script?

Whenever I run this script, a lot of dialog windows open, saying something like 'File not located or without read permission'...

This copy can take a really long time?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.