Page 1 of 1 1
Topic Options
#63698 - 2002-03-08 10:33 AM Progress bar while copying files
Anonymous
Unregistered


Hi all

I want to get a progress bar or something while i'm copying a file from a remote location to the local pc.

Anyone with an Idea how to manage this??

Top
#63699 - 2002-03-08 10:49 AM Re: Progress bar while copying files
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
Arjen,
This is one of the most frequent requests, and there are a number of ways of doing it, depending on whether you want a GUI or console result.

Rather than repeat them here, try searching the forums for "progress bar" to pick up the previous threads. You'll find quite a few (I got 40 hits), and the ones in the UDF library forum are probably the best place to start.

Top
#63700 - 2002-03-08 11:10 AM Re: Progress bar while copying files
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11631
Loc: CA
Here is a UDF Arjen

UDF PBar() - Progress bar for DOS console

For use with KiXtart 4.02
PBar() - Progress bar for DOS console

Top
#63701 - 2002-03-08 01:55 PM Re: Progress bar while copying files
Anonymous
Unregistered


Thnx all... [Smile]

I fixed it with:
code:
$dir= dir("\\logonserver\netlogon\mcafee\datfile\*.zip")
run '%comspec% /c copy \\logognserver\netlogon\mcafee\datfile\$dir c:\mcafee\datfile >>c:\mcafee.txt'
$I= "."
do $I
$size1 = Getfilesize("\\logonserver\netlogon\mcafee\datfile\$dir")
$size2 = GetFileSize("c:\mcafee\datfile\$dir")
sleep 1
until $size1 = $size2


Top
#63702 - 2002-03-08 03:01 PM Re: Progress bar while copying files
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
If you want to display the progress of a file copy, how about:
code:
$iSourceSize = Getfilesize($sSourceFile)
$iDestinationSize=0
Run '%comspec% /c copy $sSourceFile $sDestinationFile >>c:\mcafee.txt'
$iDestinationSize = GetFileSize($sDestinationFile)
While $iDestinationSize < $iSourceSize
Chr(13) "Copying - please wait: $iDestinationSize/$iSourceSize (" $iDestinationSize * 100 / $iSourceSize "%)"
Sleep 1
$iDestinationSize = GetFileSize($sDestinationFile)
Loop
Chr(13) " " Chr(13)

Given $sSourceFile and $sDesinationFile it'll display a rising file count and a percentage.

Top
#63703 - 2002-03-19 06:48 AM Re: Progress bar while copying files
jtrainer Offline
Fresh Scripter

Registered: 2002-03-06
Posts: 36
These are great examples, but how about an unknown directory size, and I want to xcopy all files/dir every day during logon ofr a program update. This will be controlled by a value read from the registery, and then if needed do the xcopy.

Thnkx
John

Darn mouse moved, time to reboot windows
_________________________
Bumped my mouse again, time to reboot Windoze....
Top
#63704 - 2002-03-19 11:58 AM Re: Progress bar while copying files
Alex.H Offline
Seasoned Scripter

Registered: 2001-04-10
Posts: 406
Loc: France
John,
The word unknown is not really good to use a progress bar. Ever if you don't know it, you have to get the total number just before using any progress bar, otherwise you can't say what is the max value and the current value to update it.
The progress bar is here to say how much time you can take for your coffee, uh ? [Big Grin]

Alex

Sorry if i seems to be cold, it wasn't in this meaning
_________________________
? getobject(Kixtart.org.Signature)

Top
#63705 - 2002-03-20 08:23 PM Re: Progress bar while copying files
Anonymous
Unregistered


If you've got unknown file sizes (and you're into visual basic) you might want to check out my gui status window for kix scripts. It's the source, so you'd need visual basic to compile it. If you're interested... http://www.nsss.net:81
Top
#63706 - 2002-03-21 12:23 AM Re: Progress bar while copying files
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Indeed, morbid was definitely one of the early pioneers of the login script proggy-bar. But aside from the neat tools discussed so far, there are a few other ones out there. Here's one thats been around for a dogs age and that I'm particularly fond of. It's called loginscreen.exe and its avaliable from here:

Free COM objects and other tools for the script developer

If I was going to implement a login script progessbar, this would be on my short list. Its implemented as an ActiveX server application (.exe not a DLL). What this means is that the loginscreen window stays active and responsive to user input while your login script is executing. There are two seperate threads of execution, not just one as with a DLL snapin. Only problem is - its written in VB - which means it will fail on any workstation that doesn't have the VB runtimes installed (which may or may not be a problem for you) ... It also allows you to customize the window, display a bitmap, all that stuff, here's a VBS sample script of that:

'The following script illustrates how to use the methods and functions
'of the control. In order to use copy loginscreen.exe to a
'directory in your path Preferrably %windir% or %windir%\system32
'You should be able to run this script as is if you want to see how it
'works.

Set LoginBox = CreateObject("Loginscreen.Main")
LoginBox.Start

LoginBox.SetTitle("Acme Widgets IT Services")
LoginBox.Pbar(10)
msgbox "okay"

Text = "Mapping 1st Drive"
LoginBox.SetDisplayMessage(Text)
LoginBox.Pbar(20)
msgbox "okay"

Text = Text & vbcrlf & "Mapping 2nd Drive"
LoginBox.SetDisplayMessage(Text)
LoginBox.Pbar(35)
msgbox "okay"

LoginBox.SetImage("c:\temp\paranet1.bmp")
LoginBox.Pbar(45)
msgbox "okay"

LoginBox.SetWelcomeMessage("Hey There!!")
LoginBox.Pbar(60)
msgbox "okay"

LoginBox.SetWaitMessage("Please be patient will you are being logged in.")
LoginBox.Pbar(75)
msgbox "okay"

LoginBox.NoImage
LoginBox.Pbar(90)
msgbox "okay"

LoginBox.NoDisplayMessage
LoginBox.Pbar(100)
msgbox "okay"

LoginBox.NoPBar
msgbox "okay"

LoginBox.Kill
Set LoginBox = nothing

-Shawn

[ 21 March 2002, 02:22: Message edited by: Shawn ]

Top
Page 1 of 1 1


Moderator:  Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 764 anonymous users online.
Newest Members
ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder, M_Moore
17887 Registered Users

Generated in 0.094 seconds in which 0.062 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org