Re: xcopy and vbscript
- From: mr_unreliable <kindlyReplyToNewsgroup@xxxxxxxxxxx>
- Date: Wed, 06 Jun 2007 17:33:40 -0400
hi Sharpshooter,
Yes, fso is slow, and in certain circles (the winapi ng
for example) it is considered to be beneath comtempt.
However, it is a tried-and-true tool for scripters.
If you want a "faster" then you could try the
"shell.application" copyhere method. A demo script is
attached. Also, copyhere has some side benefits. It
will show the same copy dialog as the system uses.
(note that you will only see the dialog if the copy
takes some time. If the copy goes very quickly, you
won't see the dialog).
And yes, xcopy is also faster than fso.
One final thought. Strange as it may seem, not all
flash drives run at the same speed (gasp!) -- at least
on my system. For example, the sony drive has compression,
which may be good news or bad news. Good news if you want
more capacity. Bad news if you want speed, because there
is a noticeable delay in reading and writing to it.
cheers, jw
____________________________________________________________
You got questions? WE GOT ANSWERS!!! ..(but,
no guarantee the answers will be applicable to the questions)
shrpshtr wrote:
With the help of some great folks here, I am running a vb script to' script to demo shell.application (for IE4/5 in win98)
backup a user's files to a usb drive. It is working beautifully with
one minor problem. It takes about 5-6 minutes to backup approximately
200-300mb. Will xcopy reduce the time it takes to copy the data over
to the usb drive? A copy of the script is below for reference.
Thanks in advance.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.CreateFolder(strFolderName)
Const OverwriteExisting = TRUE
Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.CopyFolder "C:\documents and settings\erobbins\my documents
\*.*" , strFolderName , OverwriteExisting
Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.CopyFile "C:\documents and settings\erobbins\my documents
\*.*" , strFolderName , OverwriteExisting
Set objFSO = CreateObject("Wscript.Shell")
strMessage = "Backup Complete. Click OK to Finish."
ObjShell.Popup strMessage, 5, "Backup Complete", OK_Button
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
shrp
Option Explicit
Dim oSHApp ' as object
Dim sSrc, sDest ' as string
Const FOF_SIMPLEPROGRESS = 256 '(&H100)
Set oSHApp = CreateObject("Shell.Application")
sSrc = "c:\windows\temp\*.*"
sDest = "A:\"
' use ms Animated Copy Applet, showing names and progressbar...
oSHApp.Namespace(sDest).CopyHere sSrc
' use ms Animated Copy Applet, showing progressbar (but no names)...
oSHApp.Namespace(sDest).CopyHere sSrc, FOF_SIMPLEPROGRESS
Set oSHApp = nothing ' clean up
WScript.Quit
- Follow-Ups:
- Re: xcopy and vbscript
- From: shrpshtr
- Re: xcopy and vbscript
- References:
- xcopy and vbscript
- From: shrpshtr
- xcopy and vbscript
- Prev by Date: Need help to list all groups that are members of groups.
- Next by Date: Re: Adding permissions to allow a security group to use a printer
- Previous by thread: xcopy and vbscript
- Next by thread: Re: xcopy and vbscript
- Index(es):