FC.EXE: Is there a faster alternative?

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Clueless in Seattle
Posts: 47
Joined: 01 Jul 2011 13:37

FC.EXE: Is there a faster alternative?

#1 Post by Clueless in Seattle » 17 Jun 2016 12:15

Summary: Is there an MS-DOS utility to compare the filenames, file sizes, date and time stamps, of two files and report back if they are identical or different?

Explanation: I'm running MS-DOS 6.21 on a pre-historic Dell Inpiron 1100 laptop.

I save all my work to 1.44 mb floppy disks and keep 3 copies of each file, one copy on each of three disks. I back-up often, i.e., every few minutes.

Years ago I wrote a little batch file that I run from my text editor (TSE 2.5) that first checks the current version of the text file in memory against the the last saved version of the file on the floppy disk. When it detects a change it then proceeds to back-up the text file from the laptop's memory onto the floppy disk, and also gives me the option to proceed to making one or two more back-ups on separate floppies.

This batch file has worked well for me all these years, but it has one annoying and tedious drawback: In my batch file I used the DOS utility FC.EXE to compare the file in memory with the file on the floppy. And as the file I'm working on grows in size, it seems that the time FC.EXE takes to make the comparison increases exponentially. I suspect that the reason for this is that FC.EXE laboriously scans through and compares each and every character in both files from beginning to end. And the bottleneck is the slow access to the floppy drive.

I'm thinking that there might be a much quicker and simpler way to compare the files, such as by just looking at the file name, size, date and time, without having to go through each file character by character.

Is there a utility that does this? If so, do you think it would work just as reliably as FC.EXE in my batch file?

Will in Seattle
a.k.a. "Clueless"

aGerman
Expert
Posts: 4654
Joined: 22 Jan 2010 18:01
Location: Germany

Re: FC.EXE: Is there a faster alternative?

#2 Post by aGerman » 17 Jun 2016 13:10

I'm not familiar with DOS. Just found that the BACKUP command should be available there. Options /M, /D, and /T could be suitable.

Regards
aGerman

einstein1969
Expert
Posts: 941
Joined: 15 Jun 2012 13:16
Location: Italy, Rome

Re: FC.EXE: Is there a faster alternative?

#3 Post by einstein1969 » 17 Jun 2016 13:16

The FC utility is fast if used outer a FOR cicle. Can you post your code that use FC?

Einstein1969

einstein1969
Expert
Posts: 941
Joined: 15 Jun 2012 13:16
Location: Italy, Rome

Re: FC.EXE: Is there a faster alternative?

#4 Post by einstein1969 » 17 Jun 2016 13:36

If your fc is outer a cicle for, you can try to optimize floppy access using the command BUFFERS and FILES in your config.sys

Clueless in Seattle
Posts: 47
Joined: 01 Jul 2011 13:37

Re: FC.EXE: Is there a faster alternative?

#5 Post by Clueless in Seattle » 17 Jun 2016 13:47

Thanks, einstein1969, for you speedy reply.
einstein1969 wrote:If your fc is outer a cicle for, you can try to optimize floppy access using the command BUFFERS and FILES in your config.sys

I'm afraid I'm not very tech savvy so I don't understand what "outer a cicle for" means.

What values would you suggest I enter for BUFFERS and FILES in my config.sys file?

Would you like me to post my config.sys file here? And also my batch file?

Will in Seattle
a.k.a. "Clueless"

einstein1969
Expert
Posts: 941
Joined: 15 Jun 2012 13:16
Location: Italy, Rome

Re: FC.EXE: Is there a faster alternative?

#6 Post by einstein1969 » 17 Jun 2016 14:45

Clueless in Seattle wrote:Thanks, einstein1969, for you speedy reply.
einstein1969 wrote:If your fc is outer a cicle for, you can try to optimize floppy access using the command BUFFERS and FILES in your config.sys

I'm afraid I'm not very tech savvy so I don't understand what "outer a cicle for" means.

What values would you suggest I enter for BUFFERS and FILES in my config.sys file?

Would you like me to post my config.sys file here? And also my batch file?

Will in Seattle
a.k.a. "Clueless"


Yes, post these files.

How many RAM has your PC? If you have lot of ram you can also use the smartdrv command for speedup the floppy access.

Clueless in Seattle
Posts: 47
Joined: 01 Jul 2011 13:37

Re: FC.EXE: Is there a faster alternative?

#7 Post by Clueless in Seattle » 17 Jun 2016 14:47

einstein1969 wrote:The FC utility is fast if used outer a FOR cicle. Can you post your code that use FC?

Oops! I missed your earlier message.

I won't be able to get to it until later tonight or tomorrow morning. I'll gather up the info you requested and post it then.

Will in Seattle
a.k.a. "Clueless

Clueless in Seattle
Posts: 47
Joined: 01 Jul 2011 13:37

Re: FC.EXE: Is there a faster alternative?

#8 Post by Clueless in Seattle » 18 Jun 2016 07:52

einstein1969 wrote:How many RAM has your PC? If you have lot of ram you can also use the smartdrv command for speedup the floppy access.


Hi again, einstein1969, I'm not sure how much RAM this old laptop has installed, but here's what the MEM command shows:

Memory Type Total = Used + Free
---------------- ------- ------- -------
Conventional 640K 126K 514K
Upper 75K 44K 31K
Reserved 0K 0K 0K
Extended (XMS)* 65,460K 65,460K 0K
---------------- ------- ------- -------
Total memory 66,175K 65,630K 545K

Total under 1 MB 715K 170K 545K

Total Expanded (EMS) 33,152 (33,947,648 bytes
Free Expanded (EMS)* 0K (0 bytes)

* EMM386 is using XMS memory to simulate EMS memory as needed.
Free EMS memory may change as free XMS memory changes.

Largest executable program size 514K (526,128 bytes)
Largest free upper memory block 31K (31,568 bytes)
The high memory area is available.

Do you know if there's a DOS utility that will show me the installed RAM?

Will in Seattle
a.k.a. "Clueless"

Clueless in Seattle
Posts: 47
Joined: 01 Jul 2011 13:37

Re: FC.EXE: Is there a faster alternative?

#9 Post by Clueless in Seattle » 18 Jun 2016 08:05

einstein1969 wrote:Can you post your code that use FC?


Code: Select all

:Compare
   rem @echo off
   set FC=c:\dos621\fc.exe
   set FIND=c:\dos621\find.exe
   %FC% /b %1 %2|%FIND% "FC: no differences encountered">nul

   if errorlevel 2 echo [%0]  ERRORLEVEL = 2
   if errorlevel 2 goto PROBLEM
   if errorlevel 1 echo [%0]  ERRORLEVEL = 1
   if errorlevel 1 goto DIFFER
   if errorlevel 0 echo [%0]  ERRORLEVEL = 0
   goto SAME

Clueless in Seattle
Posts: 47
Joined: 01 Jul 2011 13:37

Re: FC.EXE: Is there a faster alternative?

#10 Post by Clueless in Seattle » 18 Jun 2016 10:37

aGerman wrote:I'm not familiar with DOS. Just found that the BACKUP command should be available there. Options /M, /D, and /T could be suitable.


Hallo aGerman! Thanks for that tip! BACKUP just might work for me. I'll give it a try.

Will in Seattle
a.k.a. "Clueless"

einstein1969
Expert
Posts: 941
Joined: 15 Jun 2012 13:16
Location: Italy, Rome

Re: FC.EXE: Is there a faster alternative?

#11 Post by einstein1969 » 18 Jun 2016 13:03

Seem that you have a lot of memory.

Try to use the SMARTDRV.exe

EDIT:
try this code :

Code: Select all

   %FC% /b %1 %2 >out.txt
   %FIND% "FC: no differences encountered" out.txt >nul


einstein1969

Clueless in Seattle
Posts: 47
Joined: 01 Jul 2011 13:37

SOLVED? Re: FC.EXE: Is there a faster alternative?

#12 Post by Clueless in Seattle » 18 Jun 2016 15:43

einstein1969 wrote:Try to use the SMARTDRV.exe
Hi again, einstein. I should have mentioned in my first post, that although I'm running MS-DOS 6.21, I'm running it and all my DOS software under the DOSSHELL task switcher that came with MS-DOS 5. And DOSSHELL won't let me run SMARTDRV. :?
einstein1969 wrote:try this code :

Code: Select all

   %FC% /b %1 %2 >out.txt
   %FIND% "FC: no differences encountered" out.txt >nul
OK, I'll give that a try to see how it works for me.

In the meantime, though, I think I've found a work-around. I rewrote my batch files so they always maintain a copy of the file from floppy drive a:on my RAM drive e: so I can have the batch file use FC to compare both of the files on the RAM drive, instead of between the RAM drive and the floppy drive a:. I just ran a test and the file comparison with FC.exe seems to have completed the task almost instaneously. In fact happened so fast I wonder if I mistyped the command line in my batch file, so I'm going to have to go back and check it out to make sure the FC operation is actually being performed. I probably won't get around to that until tomorrow, though.

But, for now, it looks like I may have found a solution to the problem,

Guglielmo a Seattle
a.k.a. "Clueless"

Post Reply