Discussion:
Copy with progress indicator
(too old to reply)
A.D. Fundum
2012-05-03 13:02:03 UTC
Permalink
Is there a COPY with a progress indicator (and support for files
larger than 2 GB)? I don't mean a fully equiped file manager, I mean
some replacement for the built-in copy. I do prefer the use of the
default COPY command, but in some situations (e.g. when copying a
large file to an USB 1.1 device) a progress indicator would be
nice-to-have.


--
Dave Saville
2012-05-03 15:53:25 UTC
Permalink
Post by A.D. Fundum
Is there a COPY with a progress indicator (and support for files
larger than 2 GB)? I don't mean a fully equiped file manager, I mean
some replacement for the built-in copy. I do prefer the use of the
default COPY command, but in some situations (e.g. when copying a
large file to an USB 1.1 device) a progress indicator would be
nice-to-have.
Run a ftp daemon and then ftp localhost. A lot of FTP clients either
show a progress bar or an increasing byte count.

HTH
--
Regards
Dave Saville
A.D. Fundum
2012-05-03 20:44:15 UTC
Permalink
Post by Dave Saville
Run a ftp daemon and then ftp localhost. A lot of FTP clients
either show a progress bar or an increasing byte count.
I already had the opposite idea. The free space of the target drive
can be queried (step 1: could the large file fit?), and its remaining
free space can be used to roughly calculate the progress every XX
seconds. So if you're copying a 800 KB file to an empty 1.44 MB drive
A:, a remaining free space of 1.04 MB means over 50% of the file is
copied.

It would be about as accurate as a Microsoft progress bar, but OTOH
copying a 1.8 GB file to an USB 1.1 device can take a long tike, so a
progress of a rounded 1% isn't that accurate anyway.


--
Paul Ratcliffe
2012-05-04 07:55:42 UTC
Permalink
Post by A.D. Fundum
I already had the opposite idea. The free space of the target drive
can be queried (step 1: could the large file fit?), and its remaining
free space can be used to roughly calculate the progress every XX
seconds. So if you're copying a 800 KB file to an empty 1.44 MB drive
A:, a remaining free space of 1.04 MB means over 50% of the file is
copied.
A mad idea unless you have exclusive access to the disk. You only need
something else writing or deleting and the calculation is blown wide
open.
A.D. Fundum
2012-05-04 17:40:38 UTC
Permalink
Post by Paul Ratcliffe
Post by A.D. Fundum
So if you're copying a 800 KB file to an empty 1.44 MB
drive A:, a remaining free space of 1.04 MB means
over 50% of the file is copied.
A mad idea unless you have exclusive access to the disk.
Nevertheless it was the solution involving the built-in COPY and a
waiting human, wondering what the disappointing progress was after
about one hour.
Post by Paul Ratcliffe
You only need something else writing or deleting and the
calculation is blown wide open.
Yes and no. The yes is obvious indeed.

Right now one doesn't have a clue, "something else" has to be quite
large in order to significantly disturb an operation involving a few
GB, and it certainly ain't as mad as both waiting for the completed
copy and using the slow device at the same time. It can take several
hours and many GB, anything not exceeding 1% of that is hardly worth
noticing. Rounding is yet another trick, display 0.1 of a GB and
display minutes. That excludes a lot of "something else", going on at
the same time while you're waiting (i.e. looking at some progress
indicator).

Of course a more generic solution has to be both far better and more
accurate, like FF's download manager. My non-existing daemon is a
sloppy hack, which ougt to be written in VB.


--
Steven Levine
2012-05-03 16:19:41 UTC
Permalink
On Thu, 3 May 2012 13:02:03 UTC, "A.D. Fundum" <***@neverm.ind>
wrote:

Hi,
Post by A.D. Fundum
some replacement for the built-in copy. I do prefer the use of the
default COPY command, but in some situations (e.g. when copying a
large file to an USB 1.1 device) a progress indicator would be
nice-to-have.
It's an unusual use-case, but you could do

rsync --times --progress --human-readable from-file to-dir

The only downside is no renaming and no command line wildcards (yet).

Steven
--
---------------------------------------------------------------------
Steven Levine <***@earthlink.bogus.net>
eCS/Warp/DIY etc. www.scoug.com www.ecomstation.com
---------------------------------------------------------------------
A.D. Fundum
2012-05-03 20:52:21 UTC
Permalink
Post by Steven Levine
It's an unusual use-case, but you could do
rsync --times --progress --human-readable from-file to-dir
The only downside is no renaming and no command line wildcards
(yet).

That's fine, I'm not looking for an exact COPY replica using a DosCopy
API. I may write my own, because so far all solutions are based on a
single file (FTP, RSYNC). Maybe FTP supports wildcards, but e.g.
FTP-PM won't display the progress of all files at once.

IRL a recorder tv programme of e.g . 1.5 GB has to be copied to and
from an USB device, so a syntax of ...

XLCOPY <source file> <target drive>

... will do. The only mentioned thing I don't need now is large file
support, but supporting files larger than 2 GB would make sense.


--
Steve Wendt
2012-05-04 03:49:58 UTC
Permalink
Post by A.D. Fundum
That's fine, I'm not looking for an exact COPY replica using a DosCopy
API. I may write my own, because so far all solutions are based on a
single file (FTP, RSYNC). Maybe FTP supports wildcards, but e.g.
FTP-PM won't display the progress of all files at once.
mput accepts wildcards, and there's plenty of GUI (and TUI, such as
ncftp) FTP programs with progress indicators. Not that I would
personally suggest using FTP for local transfers (seems silly).
A.D. Fundum
2012-05-04 13:48:52 UTC
Permalink
Post by Steve Wendt
FTP
accepts wildcards
Having thought about it, so should an app copying one file. To be able
to use T*.MPG instead of "The Schaffhausen Orchesta - Second Practice
DVD Recording.MPG".

Below is a Q&D Rexx version. It's rather easy to add support for
multiple files, there's room for improvement, an audio signal may be
added when it's done, most likely the math isn't perfect, and it
supports the same maximum file size the Rexx interpreter of your
choice.


--

/* XLCopy.CMD */

CALL RxFuncAdd 'SysLoadFuncs','Rexxutil','SysLoadFuncs'
CALL SysLoadFuncs

CALL SysCls
PARSE ARG args
IF args='' THEN DO
SAY
SAY 'XLCopy copies a single file and displays a progress indicator.'
SAY
SAY 'Usage:'
SAY
SAY ' XLCOPY.CMD <file> <drive>'
SAY
SAY 'Example:'
SAY
SAY ' XLCOPY.CMD "U:\First R*.MPG" I:'
SAY
EXIT
END

PARSE VAR args file drive
IF Left(file,1)='"' THEN PARSE VAR args '"' file '"' drive
IF drive='' THEN DO
SAY 'Error: no target drive specified'
EXIT
END
IF Length(drive)<>2 '' THEN DO
SAY 'Error: no valid target drive specified'
EXIT
END
IF Right(drive,1)<>':' THEN DO
SAY 'Error: no valid target drive specified'
EXIT
END
drive=Translate(drive)

drives=SysDriveMap()
IF Pos(drive,drives,1)=0 THEN DO
SAY 'Error: drive' drive 'not found'
EXIT
END
IF SysFileTree(file,'files.','FO')=2 THEN DO
SAY 'Error: not enough memory available to query a list of files'
EXIT
END
IF files.0=0 THEN DO
SAY 'Error: no files found matching' file
EXIT
END
IF files.0>1 THEN DO
SAY 'Error: more than one file is matching' file
EXIT
END
free=SysDriveInfo(drive)
IF free='' THEN DO
SAY 'Error: drive' drive 'not accessible'
EXIT
END
size=Stream(files.1,'C','QUERY SIZE')
IF Word(free,2)<size THEN DO
SAY 'Error: not enough free space available on drive' drive
EXIT
END
IF size=0 THEN DO
SAY 'Error: size of file' files.1 'is 0'
EXIT
END
name=FileSpec('N',files.1)
target=drive||name
IF Stream(target,'C','QUERY EXISTS')<>'' THEN DO
SAY 'Error: file' name 'already exists on drive' drive
EXIT
END

PARSE VALUE SysTextScreenSize() WITH height width
IF height<3 THEN DO
SAY 'Error: the height of the screen is not at least 3 characters'
EXIT
END
IF width<3 THEN DO
SAY 'Error: the width of the screen is not at least 3 characters'
EXIT
END

SAY
PARSE VALUE SysCurPos() WITH y .
CALL CharOut '','|'
DO x=1 TO width-2
CALL CharOut '','-'
END x
CALL CharOut '','|'

pixel=size/(width-2)
firstpixel=1
pixels=0
read=0
readtotal=0
DO WHILE Chars(files.1)>0
data=CharIn(files.1,,8192)
len=Length(data)
read=read+len
readtotal=readtotal+len
CALL CharOut target,data
IF read>=pixel THEN DO
pixels=pixels+1
pixels=Max(pixels,Format((readtotal/size)*(width-2)+0.5,,0))
IF pixels>width-2 THEN pixels=width-2
read=0
DO x=firstpixel TO pixels
CALL SysCurPos y,x
CALL CharOut '','='
END x
firstpixel=pixels
END
END

CALL CharOut files.1
CALL CharOut target
SAY

EXIT
A.D. Fundum
2012-05-04 15:17:53 UTC
Permalink
Post by A.D. Fundum
/* XLCopy.CMD */
Improved version, now actually supporting long file names and giving
it a PM'ish UI when used properly with the Install.CMD's WPS object
(file's drop target):
--
/* Install.CMD */

CALL RxFuncAdd 'SysCreateObject','RexxUtil','SysCreateObject'

SAY
SAY 'Creating a WPS object for XLCopy...'
SAY

IF Stream('XLCOPY.CMD','C','QUERY EXISTS')='' THEN DO
SAY 'Error: file XLCOPY.CMD not found in the current directory'
SAY
EXIT
END

class='WPProgram'
title='XLCopy'
location='<WP_DESKTOP>'
setup='EXENAME='||Directory()||'\XLCopy.CMD;'
setup=setup||'PARAMETERS="%*" [Which drive?];'
option='U'
IF SysCreateObject(class,title,location,setup,option)=0 THEN DO
SAY 'Error creating WPS objects for XLCopy'
SAY
EXIT
END
SAY 'WPS object created for XLCopy'
SAY

EXIT
A.D. Fundum
2012-05-04 15:23:47 UTC
Permalink
Post by A.D. Fundum
/* XLCopy.CMD */
Improved version, now actually supporting long file names. Optionally
remove or change the third line (reading '@MODE 42,3') when not used
with its WPS object. This makes the VIO window look like a smaller
progress bar. At least one bug is remaining, the first '=' appears too
soon.
--
/* XLCopy.CMD */

'@MODE 42,3'

CALL RxFuncAdd 'SysLoadFuncs','Rexxutil','SysLoadFuncs'
CALL SysLoadFuncs

CALL SysCls
PARSE ARG args
IF args='' THEN DO
SAY
SAY 'XLCopy copies a single file and displays a progress indicator.'
SAY
SAY 'Usage:'
SAY
SAY ' XLCOPY.CMD <file> <drive>'
SAY
SAY 'Example:'
SAY
SAY ' XLCOPY.CMD "U:\First R*.MPG" I:'
SAY
EXIT
END

PARSE VAR args file drive
IF Left(args,1)='"' THEN PARSE VAR args '"' file '"' drive
file=Strip(file)
drive=Strip(drive)

IF drive='' THEN DO
SAY 'Error: no target drive specified'
EXIT
END
IF Length(drive)<>2 '' THEN DO
SAY 'Error: no valid target drive specified'
EXIT
END
IF Right(drive,1)<>':' THEN DO
SAY 'Error: no valid target drive specified'
EXIT
END
drive=Translate(drive)

drives=SysDriveMap()
IF Pos(drive,drives,1)=0 THEN DO
SAY 'Error: drive' drive 'not found'
EXIT
END
IF SysFileTree(file,'files.','FO')=2 THEN DO
SAY 'Error: not enough memory available to query a list of files'
EXIT
END
IF files.0=0 THEN DO
SAY 'Error: no files found matching' file
EXIT
END
IF files.0>1 THEN DO
SAY 'Error: more than one file is matching' file
EXIT
END
free=SysDriveInfo(drive)
IF free='' THEN DO
SAY 'Error: drive' drive 'not accessible'
EXIT
END
size=Stream(files.1,'C','QUERY SIZE')
IF Word(free,2)<size THEN DO
SAY 'Error: not enough free space available on drive' drive
EXIT
END
IF size=0 THEN DO
SAY 'Error: size of file' files.1 'is 0'
EXIT
END
name=FileSpec('N',files.1)
target=drive||name
IF Stream(target,'C','QUERY EXISTS')<>'' THEN DO
SAY 'Error: file' name 'already exists on drive' drive
EXIT
END

PARSE VALUE SysTextScreenSize() WITH height width
IF height<3 THEN DO
SAY 'Error: the height of the screen is not at least 3 characters'
EXIT
END
IF width<3 THEN DO
SAY 'Error: the width of the screen is not at least 3 characters'
EXIT
END

SAY
PARSE VALUE SysCurPos() WITH y .
CALL CharOut '','|'
DO x=1 TO width-2
CALL CharOut '','-'
END x
CALL CharOut '','|'

pixel=size/(width-2)
firstpixel=1
pixels=0
read=0
readtotal=0
DO WHILE Chars(files.1)>0
data=CharIn(files.1,,8192)
len=Length(data)
read=read+len
readtotal=readtotal+len
CALL CharOut target,data
IF read>=pixel THEN DO
pixels=pixels+1
pixels=Max(pixels,Format((readtotal/size)*(width-2)+0.5,,0))
IF pixels>width-2 THEN pixels=width-2
read=0
DO x=firstpixel TO pixels
CALL SysCurPos y,x
CALL CharOut '','='
END x
firstpixel=pixels
END
END

CALL CharOut files.1
CALL CharOut target
SAY

EXIT
A.D. Fundum
2012-05-05 13:34:36 UTC
Permalink
Post by A.D. Fundum
Post by A.D. Fundum
/* XLCopy.CMD */
Improved version, now actually supporting long file names.
Optionally remove or change the third line (reading
This final improved version supports multiple files (larger than 0
bytes), e.g.:

XLCOPY D:\CAMERA\MOVIES\*.AVI C:
--
/* XLCopy.CMD */

NUMERIC DIGITS 16

'@MODE 42,3'

CALL RxFuncAdd 'SysLoadFuncs','Rexxutil','SysLoadFuncs'
CALL SysLoadFuncs

CALL SysCls
PARSE ARG args
IF args='' THEN DO
SAY
SAY 'XLCopy copies files and displays a progress indicator.'
SAY
SAY 'Usage:'
SAY
SAY ' XLCOPY.CMD <filemask> <drive>'
SAY
SAY 'Example:'
SAY
SAY ' XLCOPY.CMD "U:\First Rec*.MPG" I:'
SAY
EXIT
END

PARSE VAR args file drive
IF Left(args,1)='"' THEN PARSE VAR args '"' file '"' drive
file=Strip(file)
drive=Strip(drive)
IF drive='' THEN DO
SAY 'Error: no target drive specified'
EXIT
END
IF Length(drive)<>2 '' THEN DO
SAY 'Error: no valid target drive specified'
EXIT
END
IF Right(drive,1)<>':' THEN DO
SAY 'Error: no valid target drive specified'
EXIT
END
drive=Translate(drive)

drives=SysDriveMap()
IF Pos(drive,drives,1)=0 THEN DO
SAY 'Error: drive' drive 'not found'
EXIT
END
IF SysFileTree(file,'files.','FO')=2 THEN DO
SAY 'Error: not enough memory available to query a list of files'
EXIT
END
IF files.0=0 THEN DO
SAY 'Error: no files found matching' file
EXIT
END
free=SysDriveInfo(drive)
IF free='' THEN DO
SAY 'Error: drive' drive 'not accessible'
EXIT
END
size=0
DO i=1 TO files.0
thissize=Stream(files.i,'C','QUERY SIZE')
IF thissize=0 THEN DO
SAY 'Error: size of file' files.i 'is 0 bytes'
EXIT
END
size=size+thissize
END i
IF Word(free,2)<size THEN DO
SAY 'Error: not enough free space available on drive' drive
EXIT
END
DO i=1 TO files.0
name=FileSpec('N',files.i)
target.i=drive||name
IF Stream(target.i,'C','QUERY EXISTS')<>'' THEN DO
SAY 'Error: file' name 'already exists on drive' drive
EXIT
END
END i

PARSE VALUE SysTextScreenSize() WITH height width
IF height<3 THEN DO
SAY 'Error: the height of the screen is not at least 3 characters'
EXIT
END
IF width<3 THEN DO
SAY 'Error: the width of the screen is not at least 3 characters'
EXIT
END

SAY
PARSE VALUE SysCurPos() WITH y .
CALL CharOut '','|'
DO x=1 TO width-2
CALL CharOut '','-'
END x
CALL CharOut '','|'

pixel=size/(width-2)
firstpixel=1
pixels=0
read=0
readtotal=0
DO i=1 TO files.0
DO WHILE Chars(files.i)>0
data=CharIn(files.i,,8192)
len=Length(data)
read=read+len
readtotal=readtotal+len
CALL CharOut target.i,data
IF read>=pixel THEN DO
pixels=pixels+1
pixels=Max(pixels,Format((readtotal/size)*(width-2)+0.00001,,0))
IF pixels>width-2 THEN pixels=width-2
read=0
DO x=firstpixel TO pixels
CALL SysCurPos y,x
CALL CharOut '','='
END x
firstpixel=pixels
END
END
CALL CharOut files.i
CALL CharOut target.i
END i
DO x=firstpixel TO width-2
CALL SysCurPos y,x
CALL CharOut '','='
END x

SAY

EXIT
A.D. Fundum
2012-06-25 10:28:54 UTC
Permalink
Post by A.D. Fundum
This final improved version supports multiple files
FWIW: one may want to exclude hidden and/or system files by using one
of the SysFileTree()-options. This version will also copy e.g. the
hidden "WP *"-file when used like this:

C:
CD \DOWNLOADS
XLCOPY F:\* C:

Solution: HELP REXX SysFileTree, parameter "tattrib". I'm not going to
add it, albeit it's likely that large files aren't hidden (not
counting Microsoft's products). Of course another solution is to use
"F:\*.MPG" instead of "F:\*".


--

Dave Yeo
2012-05-04 00:26:38 UTC
Permalink
Post by Steven Levine
Hi,
Post by A.D. Fundum
some replacement for the built-in copy. I do prefer the use of the
default COPY command, but in some situations (e.g. when copying a
large file to an USB 1.1 device) a progress indicator would be
nice-to-have.
It's an unusual use-case, but you could do
rsync --times --progress --human-readable from-file to-dir
The only downside is no renaming and no command line wildcards (yet).
Can always run it under a Unix shell to get wildcards.
Dave
Steven Levine
2012-05-04 17:43:04 UTC
Permalink
On Fri, 4 May 2012 00:26:38 UTC, Dave Yeo <***@gmail.com>
wrote:

Hi Dave,
Post by Dave Yeo
Can always run it under a Unix shell to get wildcards.
I plan to add -Zwildcard support for the next build so that the
command line semantics match *ix more closely. It appears Paul had
this in his original builds, but it did not show up in the diffs.
Possibly, it was defined in config.site.

The vast majority of rsync use-cases will not have have filename
wildcards on the command line. Most of the wildcards are for filters
and on *ix, these need to be would need to be escaped on the command
line.

Steven
--
---------------------------------------------------------------------
Steven Levine <***@earthlink.bogus.net>
eCS/Warp/DIY etc. www.scoug.com www.ecomstation.com
---------------------------------------------------------------------
Dave Yeo
2012-05-05 01:34:52 UTC
Permalink
Post by Steven Levine
Hi Dave,
Post by Dave Yeo
Can always run it under a Unix shell to get wildcards.
I plan to add -Zwildcard support for the next build so that the
command line semantics match *ix more closely. It appears Paul had
this in his original builds, but it did not show up in the diffs.
Possibly, it was defined in config.site.
Since you're patching anyways, wouldn't it be clearer to just add
_wildcard() (and _response()) to the code?
If you do add -Zargs-wild to LDFLAGS, you should also add -Zargs-resp as
well.
Dave
Steven Levine
2012-05-05 02:38:39 UTC
Permalink
On Sat, 5 May 2012 01:34:52 UTC, Dave Yeo <***@gmail.com>
wrote:

Hi Dave,
Post by Dave Yeo
Since you're patching anyways, wouldn't it be clearer to just add
_wildcard() (and _response()) to the code?
I'll think about this. The thing is I try to provide sufficient build
instructions with my distros so that this kind of thing would be
documented.
Post by Dave Yeo
If you do add -Zargs-wild to LDFLAGS, you should also add -Zargs-resp as
well.
Agreed.

Steven
--
---------------------------------------------------------------------
Steven Levine <***@earthlink.bogus.net>
eCS/Warp/DIY etc. www.scoug.com www.ecomstation.com
---------------------------------------------------------------------
Loading...