Computing.Net > Forums > Programming > Compare source filesize against copied

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Compare source filesize against copied

Reply to Message Icon

Name: jellyb
Date: August 28, 2009 at 02:55:22 Pacific
OS: Windows XP
Subcategory: Batch
Comment:

Hi,

I have a batch file that copies certain files from
a source folder to a destination by finding their
location and filename from a textfile. The script
does not copy all files, only the ones listed on
that texfile.

I would like to add a second process to
compare the sizes of the files I copied. Is this
possible somehow?

Thanks in advance!



Sponsored Link
Ads by Google

Response Number 1
Name: Judago
Date: August 28, 2009 at 03:46:38 Pacific
Reply:

GIve "for /?" a read, it shows a few modifiers to for variables(there are also equivalents for arquments -"call /?") , one of which is file size in bytes:

for %%a in ("c:\file1") do (
    for %%b in ("c:\file2") do (
        echo File1 is %%~za bytes, File2 is %%~zb bytes.
    )
)


0

Response Number 2
Name: klint
Date: August 28, 2009 at 09:27:31 Pacific
Reply:

What is the purpose of your question? If you've just copied the file, how could its size be different? If you just want to verify that you have copied the file correctly, you should use the COPY /V command line option. If you want to check that the copied file is still the same some time later, then you should also be comparing date stamps as well as sizes.

You might also be interested in certain utility programs that might do what you want, such as WinMerge or Microsoft Sync Toy.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More






Use following form to reply to current message:

Login or Register to Reply
LoginRegister


Sponsored links

Ads by Google


Results for: Compare source filesize against copied

Batch File To temporarily backup www.computing.net/answers/programming/batch-file-to-temporarily-backup-/9826.html

Delphi question need help with TLis www.computing.net/answers/programming/delphi-question-need-help-with-tlis/3408.html

check file time creation www.computing.net/answers/programming/check-file-time-creation/10438.html