You are not logged in.

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

kdar
Member
From: Sweet home Alabama!
Registered: 2009-06-27
Posts: 356

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
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,595
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: Sweet home Alabama!
Registered: 2009-06-27
Posts: 356

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: 7,131

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)


CLI Paste | How To Ask Questions

Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L

Offline

Board footer

Powered by FluxBB