A little .vbs help please

OK Rick A,

I changed this line
oft.CopyHere ofs.Items to oft.CopyHere ofs

and it does exactly what I mentioned in my previous post, but Wscript.Echo “Zip completed” is not executing hence and Wscript.Exe is not exiting now. completed"

Any suggestions?

Thanks.

Lennox

Very long names should not be a problem if the paths+names are less than 255 chars under MS Windows. If you have such kind of naming you should consider a restructuring of the three/names.

Hi Rick A,

So this
oft.CopyHere ofs.Items '** Copy files
should be
oft.CopyHere ofs '** Copy the source folder

and this should be modified something like this…
Do until oft.items. Child(oft.name) .Count >= ofs.items.Count '** Wait copy to finish
WScript.sleep 1000
Loop

How can I do that?

Thanks.

Lennox

To create folder programmatically under VBS you can read about here: http://msdn.microsoft.com/en-us/library/windows/desktop/bb787876(v=vs.85).aspx

[quote=26878:@Lennox Jacob]oft.CopyHere ofs.Items '** Copy files
should be
oft.CopyHere ofs '** Copy the source folder

and this should be modified something like this…
Do until oft.items. Child(oft.name ) .Count >= ofs.items.Count '** Wait copy to finish
WScript.sleep 1000
Loop[/quote]

I believe I am not following you here. What you mean? Why you need this?

This should be enough:

oft.CopyHere ofs.Items '** Copy files

Do until oft.items.Count >= ofs.items.Count '** Wait copy to finish
WScript.sleep 1000
Loop

Wscript.Echo “Zip probably completed”

There is no guaranties here. If the final file to be copied is large, and MS-Windows had created a file at the destination (even temporary) the monitor will count that file and see “Hey, we reached N files! Done.” even if the final file is still being copied.

Using a tool like 7ZIP should be better for such kind of task.

Thanks Rick.
I will try the 7 zip and see what happens.
Thanks again.
Lennox

:wink:

Errata number 2,352,345: “There are no guaranties here.”

OK Rick,

I did not see this in one of the previous messages…

I believe I am not following you here. What you mean? Why you need this?

oft.CopyHere ofs.Items '** Copy files will copy files from source zip, i.e. files inside of source, not the enclosing folder
The copied files would be copied to Target which has a compacted name - JONESQ~1.zip - which was created here
of.write(“PK” & chr(5) & chr(6) & string(18,chr(0))) '**Make an empty Zip File

oft.CopyHere ofs '** Copy the source folder will copy the source folder (with its original MyVeryLongNameFolder name intact) into JONESQ~1.zip, (I’ve tried it and seen that happen).

So the solution in my view, to make it work, is

  1. do that - oft.CopyHere ofs '** Copy the source folder
    and something like this… (Pseudocode with Real Studio flavour)…

Do until oft.Child(oft.name).items…Count >= ofs.items.Count '** Wait copy to finish
WScript.sleep 1000
Loop

I dont think that is a good option, and I do not know how easy one can accomplish that.

or, better…
2) If it is possible to get the original MyVeryLongNameFolder name intact and rename the target, (JONESQ~1.zip), with that original name
That, in my opinion, would be great.

Thanks again.

Lennox