Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > alt.comp.os.windows-10 > #183190

Re: what is the fastest command line copy?

From Stan Brown <the_stan_brown@fastmail.fm>
Newsgroups alt.comp.os.windows-11, alt.comp.os.windows-10
Subject Re: what is the fastest command line copy?
Date 2025-04-02 10:50 -0700
Organization Oak Road Systems
Message-ID <MPG.425718c6235f3eea9903da@news.individual.net> (permalink)
References (5 earlier) <vsea99$i2o2$1@dont-email.me> <ljsmujdighbuvcltfh5kihbmnqaqqohern@4ax.com> <vsgpfb$36vg6$1@dont-email.me> <nanpujlogu6350309ttemlh3u4u3798698@4ax.com> <vsiro1$1brfi$1@dont-email.me>

Cross-posted to 2 groups.

Show all headers | View raw


On Wed, 2 Apr 2025 04:15:57 -0400, Paul wrote: 
> 
> When those .bat files copy things, do you check
> the "error number" to see if the copy
> was successful ?
> 
> Scripting is "programming", and the same things I would
> have to check when writing a C language program, those
> are still issues when running a (so-called OS) copy program.
> 
> Here, my personal copy program returns a value of "1", if the source file
> cannot be opened. This clause was written by an AI by the way.
> "It doesn't have to make sense", as the AI would tell you :-)
> What the AI didn't tell me, is there is a bug in one of the
> library routines I should know about.

What is the bug, Paul? Or were you just referrng to your initial 
version losing %ERRORLEVEL% because you didn't save it before running 
a DIR command?

>     # part of paulcopy64.exe source code... Mostly written by an AI.
>     # I only fix them up and make them work. The comment is written by the AI.
> 
>     // Open the source file in binary mode
>     FILE *source = fopen64(argv[1], "rb");
>     if (!source) {
>         perror("Error opening source file");
>         return 1;
>     }
> 
> Now, we test in a Command Prompt, and see if the returned integer
> error code, is arriving OK or not. It is. If each error has a
> different integer number, you can tell the error types apart,
> with numeric checks of %errorlevel% .
> 
> D:\>paulcopy64 a b
> Error opening source file: No such file or directory
> 
> D:\>echo %errorlevel%
> 1                               # Om my! My copy did not proceed.
> 
> Making a batch file is not "just making a laundry list".
> It needs conditional checks (somehow) of each
> stage of the operation.  And in my C program snippet, you can see
> the AI is doing the same thing. The AI assumes I will be scripting
> calls to "paulcopy64.exe" and scripting needs the number, to check
> the program run went OK.
> 
> In scripting, you have to be careful with "volatile" items
> like an %errorlevel% . They must be copied before they are lost,
> by the next utility program loading its success or failure status
> into that single variable in the shell.
> 
> Look at the following and note my handling mistake. The error result
> from the "dir" command, has overwritten the "1" left in the %errorlevel% .
> There was no error in the "dir" run and the result from it is "0".
> 
> D:\>paulcopy64 a b
> Error opening source file: No such file or directory
> 
> D:\>dir
>  Volume in drive D
> 
>  Directory of D:\
> Tue, 03/18/2025  09:56 AM           252,122 paulcopy64.exe
> 
> D:\>echo %errorlevel%
> 0                              # Oops! I lost my copy failure code.
> 
> The paulcopy64.exe was actually compiled on Ubuntu 23.04
> as a cross compile, as I have not managed to get a good
> mingw64 for Windows set up here. So I just cross-compiled
> it, and that is why the program is 252,122 bytes, when it
> should be a lot smaller for a dumb copy program.
> 
> # Asking Ubuntu to make a 64-bit version of a Windows EXE (a PE32+ EXE file).
> # The FILE_OFFSET_BITS is to enable 64 bit long length fields and stuff.
> # The compiler package (effectively a script) must be installed for the executable
> # of the compiler, to be found.  "x86_64-w64-mingw32-gcc" does not exist by default.
> # This allows my program to have "gobs" of RAM, compiling it this way :-)
> 
> /usr/bin/x86_64-w64-mingw32-gcc -D_FILE_OFFSET_BITS=64 -I/usr/x86_64-w64-mingw32/include -o paulcopy64.exe paulcopy64.c
> 
>    Paul



-- 
Stan Brown, Tehachapi, California, USA         https://BrownMath.com/
Shikata ga nai...

Back to alt.comp.os.windows-10 | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: what is the fastest command line copy? Dual Boot Windows <invalid@invalid.invalid> - 2025-03-31 02:12 +0100
  Re: what is the fastest command line copy? Steve Hayes <hayesstw@telkomsa.net> - 2025-03-31 04:43 +0200
    Re: what is the fastest command line copy? Paul <nospam@needed.invalid> - 2025-03-31 00:47 -0400
      Re: what is the fastest command line copy? Steve Hayes <hayesstw@telkomsa.net> - 2025-03-31 11:06 +0200
      Re: what is the fastest command line copy? Stan Brown <the_stan_brown@fastmail.fm> - 2025-03-31 12:10 -0700
      Re: what is the fastest command line copy? "Jonathan N. Little" <lws4art@gmail.com> - 2025-04-01 18:56 -0400
    Re: what is the fastest command line copy? Newyana2 <newyana@invalid.nospam> - 2025-03-31 08:21 -0400
      Re: what is the fastest command line copy? "R.Wieser" <address@is.invalid> - 2025-03-31 15:47 +0200
        Re: what is the fastest command line copy? Newyana2 <newyana@invalid.nospam> - 2025-03-31 10:54 -0400
          Re: what is the fastest command line copy? Andy Burns <usenet@andyburns.uk> - 2025-03-31 15:59 +0100
          Re: what is the fastest command line copy? "R.Wieser" <address@is.invalid> - 2025-03-31 17:32 +0200
          Re: what is the fastest command line copy? Steve Hayes <hayesstw@telkomsa.net> - 2025-04-01 07:00 +0200
            Re: what is the fastest command line copy? "R.Wieser" <address@is.invalid> - 2025-04-01 09:11 +0200
            Re: what is the fastest command line copy? Paul <nospam@needed.invalid> - 2025-04-01 03:44 -0400
            Re: what is the fastest command line copy? Newyana2 <newyana@invalid.nospam> - 2025-04-01 09:26 -0400
              Re: what is the fastest command line copy? Steve Hayes <hayesstw@telkomsa.net> - 2025-04-02 08:50 +0200
                Re: what is the fastest command line copy? Paul <nospam@needed.invalid> - 2025-04-02 04:15 -0400
                Re: what is the fastest command line copy? "R.Wieser" <address@is.invalid> - 2025-04-02 10:35 +0200
                Re: what is the fastest command line copy? Paul <nospam@needed.invalid> - 2025-04-02 05:54 -0400
                Re: what is the fastest command line copy? "R.Wieser" <address@is.invalid> - 2025-04-02 16:15 +0200
                Re: what is the fastest command line copy? Paul <nospam@needed.invalid> - 2025-04-02 11:40 -0400
                Re: what is the fastest command line copy? "R.Wieser" <address@is.invalid> - 2025-04-02 18:13 +0200
                Re: what is the fastest command line copy? Paul <nospam@needed.invalid> - 2025-04-02 12:41 -0400
                Re: what is the fastest command line copy? "R.Wieser" <address@is.invalid> - 2025-04-02 20:27 +0200
                Re: what is the fastest command line copy? Paul <nospam@needed.invalid> - 2025-04-03 03:22 -0400
                Re: what is the fastest command line copy? "R.Wieser" <address@is.invalid> - 2025-04-03 13:10 +0200
                Re: what is the fastest command line copy? Newyana2 <newyana@invalid.nospam> - 2025-04-02 07:57 -0400
                Re: what is the fastest command line copy? "R.Wieser" <address@is.invalid> - 2025-04-02 16:19 +0200
                Re: what is the fastest command line copy? Newyana2 <newyana@invalid.nospam> - 2025-04-02 11:04 -0400
                Re: what is the fastest command line copy? Paul <nospam@needed.invalid> - 2025-04-02 12:04 -0400
                Re: what is the fastest command line copy? "R.Wieser" <address@is.invalid> - 2025-04-02 18:06 +0200
                Re: what is the fastest command line copy? Frank Slootweg <this@ddress.is.invalid> - 2025-04-02 12:41 +0000
                Re: what is the fastest command line copy? Paul <nospam@needed.invalid> - 2025-04-02 12:15 -0400
                Re: what is the fastest command line copy? Frank Slootweg <this@ddress.is.invalid> - 2025-04-02 17:36 +0000
                Re: what is the fastest command line copy? Stan Brown <the_stan_brown@fastmail.fm> - 2025-04-02 10:50 -0700
                Re: what is the fastest command line copy? Steve Hayes <hayesstw@telkomsa.net> - 2025-04-03 05:24 +0200
                Re: what is the fastest command line copy? Democrat <Democrat@invalid.invalid> - 2025-04-03 06:00 +0000
                Re: what is the fastest command line copy? "R.Wieser" <address@is.invalid> - 2025-04-03 08:39 +0200
                Re: what is the fastest command line copy? Steve Hayes <hayesstw@telkomsa.net> - 2025-04-03 15:55 +0200
                Re: what is the fastest command line copy? Frank Slootweg <this@ddress.is.invalid> - 2025-04-03 15:06 +0000
                Re: what is the fastest command line copy? Steve Hayes <hayesstw@telkomsa.net> - 2025-04-04 13:55 +0200
                Re: what is the fastest command line copy? Frank Slootweg <this@ddress.is.invalid> - 2025-04-04 12:11 +0000
                Re: what is the fastest command line copy? Don_from_AZ <djatechNOSPAM@comcast.net.invalid> - 2025-04-04 10:32 -0700
                Re: what is the fastest command line copy? Steve Hayes <hayesstw@telkomsa.net> - 2025-04-05 05:20 +0200
                Re: what is the fastest command line copy? T <T@invalid.invalid> - 2025-04-05 00:44 -0700
                Re: what is the fastest command line copy? Daniel70 <daniel47@eternal-september.org> - 2025-04-06 20:20 +1000
                Re: what is the fastest command line copy? "Kerr-Mudd, John" <admin@127.0.0.1> - 2025-04-06 21:15 +0100
                Re: what is the fastest command line copy? Newyana2 <newyana@invalid.nospam> - 2025-04-04 08:49 -0400
                Re: what is the fastest command line copy? Steve Hayes <hayesstw@telkomsa.net> - 2025-04-05 05:29 +0200
                Re: what is the fastest command line copy? Newyana2 <newyana@invalid.nospam> - 2025-04-05 08:26 -0400
                Re: what is the fastest command line copy? Paul <nospam@needed.invalid> - 2025-04-05 00:37 -0400
                Re: what is the fastest command line copy? Newyana2 <newyana@invalid.nospam> - 2025-04-05 08:18 -0400
                Re: what is the fastest command line copy? Char Jackson <none@none.invalid> - 2025-04-03 11:00 -0500
                Re: what is the fastest command line copy? Newyana2 <newyana@invalid.nospam> - 2025-04-02 07:53 -0400
                Re: what is the fastest command line copy? "R.Wieser" <address@is.invalid> - 2025-04-02 16:26 +0200
                Re: what is the fastest command line copy? Newyana2 <newyana@invalid.nospam> - 2025-04-02 11:03 -0400
                Re: what is the fastest command line copy? "R.Wieser" <address@is.invalid> - 2025-04-02 18:04 +0200
                Re: what is the fastest command line copy? Paul <nospam@needed.invalid> - 2025-04-02 12:36 -0400
                Re: what is the fastest command line copy? Newyana2 <newyana@invalid.nospam> - 2025-04-02 13:07 -0400
                Re: what is the fastest command line copy? Paul <nospam@needed.invalid> - 2025-04-03 04:14 -0400
                Re: what is the fastest command line copy? Newyana2 <newyana@invalid.nospam> - 2025-04-03 08:40 -0400
                Re: what is the fastest command line copy? Stan Brown <the_stan_brown@fastmail.fm> - 2025-04-02 10:43 -0700
                Re: what is the fastest command line copy? Char Jackson <none@none.invalid> - 2025-04-02 18:59 -0500
                Re: what is the fastest command line copy? Stan Brown <the_stan_brown@fastmail.fm> - 2025-04-02 11:11 -0700
        Re: what is the fastest command line copy? knuttle <keith_nuttle@yahoo.com> - 2025-03-31 10:59 -0400
          Re: what is the fastest command line copy? "R.Wieser" <address@is.invalid> - 2025-03-31 17:26 +0200
            Re: what is the fastest command line copy? Newyana2 <newyana@invalid.nospam> - 2025-03-31 13:05 -0400
              Re: what is the fastest command line copy? "R.Wieser" <address@is.invalid> - 2025-03-31 20:18 +0200
                Re: what is the fastest command line copy? Newyana2 <newyana@invalid.nospam> - 2025-03-31 14:43 -0400
    Re: what is the fastest command line copy? Stan Brown <the_stan_brown@fastmail.fm> - 2025-03-31 13:40 -0700
  Re: what is the fastest command line copy? T <T@invalid.invalid> - 2025-03-30 23:03 -0700
  Re: what is the fastest command line copy? T <T@invalid.invalid> - 2025-03-30 23:43 -0700
  Re: what is the fastest command line copy? T <T@invalid.invalid> - 2025-04-01 02:01 -0700

csiph-web