compare file

Q

Québec

Hi,
I am on win2000 and try to make your script (year 2002) works;
I dont know why the file zize does not print on screen and the copy (line I
added) dont copy too.

::comfilsiz C:\learnJava\RemindMe\RemindLog.txt
C:\learnJava\RemindMe\back\RemindLog.txt
@echo off
set /a size_of_file1= %~z1
set /a size_of_file2= %~z2

@echo.
@echo File 1 (%1) size is %size_of_file1%
@echo File 2 (%2) size is %size_of_file2%
@echo.

if %size_of_file1% GTR %size_of_file2% echo File 1 is larger than File 2.
if %size_of_file1% EQU %size_of_file2% echo File 1 is same size as File 2.
if %size_of_file1% LSS %size_of_file2% echo File 1 is smaller than File 2.

if %size_of_file1% GTR %size_of_file2% do copy %1 C:\learnJava\RemindMe\back
/Y

goto:EOF
Thanks for your attention,

Jean
Pierre Daviau
 
P

Phil Robyn

Québec said:
Hi,
I am on win2000 and try to make your script (year 2002) works;
I dont know why the file zize does not print on screen and the copy (line I
added) dont copy too.

::comfilsiz C:\learnJava\RemindMe\RemindLog.txt
C:\learnJava\RemindMe\back\RemindLog.txt
@echo off
set /a size_of_file1= %~z1
set /a size_of_file2= %~z2

@echo.
@echo File 1 (%1) size is %size_of_file1%
@echo File 2 (%2) size is %size_of_file2%
@echo.

if %size_of_file1% GTR %size_of_file2% echo File 1 is larger than File 2.
if %size_of_file1% EQU %size_of_file2% echo File 1 is same size as File 2.
if %size_of_file1% LSS %size_of_file2% echo File 1 is smaller than File 2.

if %size_of_file1% GTR %size_of_file2% do copy %1 C:\learnJava\RemindMe\back
/Y

goto:EOF
Thanks for your attention,

Jean
Pierre Daviau

Get rid of the 'do' in line 14 (below).

- - - - - - - - - - begin screen capture Win2000 - - - - - - - - - -
C:\cmd>demo\CompareTwoFileSizes logon.cmd test\reccount.cmd

File 1 (logon.cmd) size is 2477
File 2 (test\reccount.cmd) size is 179

File 1 is larger than File 2.
copy logon.cmd C:\learnJava\RemindMe\back /Y

=====begin C:\cmd\demo\CompareTwoFileSizes.cmd ====================
01. @echo off
02. set /a size_of_file1= %~z1
03. set /a size_of_file2= %~z2
04.
05. @echo.
06. @echo File 1 (%1) size is %size_of_file1%
07. @echo File 2 (%2) size is %size_of_file2%
08. @echo.
09.
10. if %size_of_file1% GTR %size_of_file2% echo File 1 is larger than File 2.
11. if %size_of_file1% EQU %size_of_file2% echo File 1 is same size as File 2.
12. if %size_of_file1% LSS %size_of_file2% echo File 1 is smaller than File 2.
13.
14. if %size_of_file1% GTR %size_of_file2% copy %1 C:\learnJava\RemindMe\back /Y
15.
16. goto:EOF
=====end C:\cmd\demo\CompareTwoFileSizes.cmd ====================
 
M

Matthias Tacke

Hi,
I am on win2000 and try to make your script (year 2002) works;
I dont know why the file zize does not print on screen and the copy (line I
added) dont copy too.

::comfilsiz C:\learnJava\RemindMe\RemindLog.txt
C:\learnJava\RemindMe\back\RemindLog.txt
@echo off
set /a size_of_file1= %~z1
set /a size_of_file2= %~z2

@echo.
@echo File 1 (%1) size is %size_of_file1%
@echo File 2 (%2) size is %size_of_file2%
@echo.

if %size_of_file1% GTR %size_of_file2% echo File 1 is larger than File 2.
if %size_of_file1% EQU %size_of_file2% echo File 1 is same size as File 2.
if %size_of_file1% LSS %size_of_file2% echo File 1 is smaller than File 2.

if %size_of_file1% GTR %size_of_file2% do copy %1 C:\learnJava\RemindMe\back
/Y

goto:EOF

Hello Jean Pierre,

the batch seams ok, the second line may be wrong. A .txt file is normally
not executable. Assuming the batch has the name comfilsiz.bat or .cmd
you should enter

comfilsiz filename1 filename2

at the commandline to get it working correctly. I would also include
a test for existence of both files.
 
P

Phil Robyn

Québec said:
Hi,
I am on win2000 and try to make your script (year 2002) works;
I dont know why the file zize does not print on screen and the copy (line I
added) dont copy too.

::comfilsiz C:\learnJava\RemindMe\RemindLog.txt
C:\learnJava\RemindMe\back\RemindLog.txt
@echo off
set /a size_of_file1= %~z1
set /a size_of_file2= %~z2

@echo.
@echo File 1 (%1) size is %size_of_file1%
@echo File 2 (%2) size is %size_of_file2%
@echo.

if %size_of_file1% GTR %size_of_file2% echo File 1 is larger than File 2.
if %size_of_file1% EQU %size_of_file2% echo File 1 is same size as File 2.
if %size_of_file1% LSS %size_of_file2% echo File 1 is smaller than File 2.

if %size_of_file1% GTR %size_of_file2% do copy %1 C:\learnJava\RemindMe\back
/Y

goto:EOF
Thanks for your attention,

Jean
Pierre Daviau

The original post was

http://www.google.com/groups?q=+"si...pt.admin&hl=en&lr=&ie=UTF-8&oe=UTF-8&filter=0

You added the 'if ... do copy ...' line, which the original did not contain.
 
Q

Québec

This is what I get . :-(
¸----------------------
C:\learnJava\RemindMe>comfilsiz RemindLog.cmd back\RemindLog.cmd
C:\learnJava\RemindMe>echo off

File 1(RemindLog.cmd) size is
File 2(back\RemindLog.cmd) size is

echo was unexpected at this time.
 
P

Phil Robyn

Québec said:
This is what I get . :-(
¸----------------------
C:\learnJava\RemindMe>comfilsiz RemindLog.cmd back\RemindLog.cmd
C:\learnJava\RemindMe>echo off

File 1(RemindLog.cmd) size is
File 2(back\RemindLog.cmd) size is

echo was unexpected at this time.

Maybe there are no files named 'RemindLog.cmd' in your directories?
 
Q

Québec

I susppect a corrupted file.

Somebody knows the dll related to cmd.exe.
I updated win2000, putted the Service Pack 4


-------------------------------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top