You are not logged in.

#1 2013-03-07 18:43:38

kdar
Member
From: Alabama!!!
Registered: 2009-06-27
Posts: 352

How to ensure that two files are different (if date and size is same)?

I been asking this at an interview today.
What do you think are some practical methods that can be used to ensure that two files, which may have same creation date and same size in bytes, are different files?

I was trying to answer it based on different densities that those two may have.

What do you think are some other options? This question made me curious about this.

Last edited by kdar (2013-03-07 18:44:18)

Offline

#2 2013-03-07 18:44:16

graysky
Member
From: /run/user/1000
Registered: 2008-12-01
Posts: 8,423
Website

Re: How to ensure that two files are different (if date and size is same)?

Checksum


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#3 2013-03-07 18:45:06

kdar
Member
From: Alabama!!!
Registered: 2009-06-27
Posts: 352

Re: How to ensure that two files are different (if date and size is same)?

graysky wrote:

Checksum

I completely forgot about this.
Are there any other methods?

Last edited by kdar (2013-03-07 20:00:06)

Offline

#4 2013-03-08 02:23:21

carlocci
Member
From: Padova - Italy
Registered: 2008-02-12
Posts: 368

Re: How to ensure that two files are different (if date and size is same)?

cmp

Offline

#5 2013-03-08 02:47:36

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 5,661

Re: How to ensure that two files are different (if date and size is same)?

diff (will tell you if they are different even if they are binary)

file

modification time, owner/group, permissions, ACLs - these won't tell you the file content is different but then the creation time wouldn't do that, either.

Last edited by cfr (2013-03-08 02:50:36)


How To Ask Questions The Smart Way | Help Vampires

Arch Linux | x86_64 | GPT | EFI boot | grub2 | systemd | LVM2 on LUKS
Lenovo x121e | Intel(R) Core(TM) i3-2367M CPU @ 1.40GHz GenuineIntel | Intel Centrino Wireless-N 1000 | US keyboard with Euro | 320G 7200 RPM Seagate HDD

Offline

Board footer

Powered by FluxBB