comp.lang.ada
 help / color / mirror / Atom feed
* operations on files and directories
@ 2006-05-03 14:42 evangeli
  2006-05-03 16:22 ` Martin Dowie
  0 siblings, 1 reply; 6+ messages in thread
From: evangeli @ 2006-05-03 14:42 UTC (permalink / raw)


Hello,
how would you do to
1 - check if two files have the same content
2 - check if two files have the same date
i looked in Ada.Directories but did not find how to do such a thing
is this in another package?
under unix i could call /usr/bin/diff and /bin/date but this would not
be portable
do you have any other idea?

Thanks,
Sami




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: operations on files and directories
  2006-05-03 14:42 operations on files and directories evangeli
@ 2006-05-03 16:22 ` Martin Dowie
  2006-05-03 16:37   ` evangeli
  0 siblings, 1 reply; 6+ messages in thread
From: Martin Dowie @ 2006-05-03 16:22 UTC (permalink / raw)


evangeli@cnam.fr wrote:
> Hello,
> how would you do to
> 1 - check if two files have the same content

You have to do that yourself or use some other library.


> 2 - check if two files have the same date

Same date for what? Creation, Modification? Access?

If it's modification time then use one of the overloaded 
"Modification_Time" subprograms. If it's creation/access then you could 
check if your compiler provides the optional standard package 
"Ada.Directories.Information" and if it is good enough to provide 
functions to access those.

See:
http://www.martin.dowie.btinternet.co.uk

and specifically:

http://www.martin.dowie.btinternet.co.uk/Directories/adabrowse/ada-directories-information.html

Cheers
-- Martin



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: operations on files and directories
  2006-05-03 16:22 ` Martin Dowie
@ 2006-05-03 16:37   ` evangeli
  2006-05-03 16:54     ` Martin Dowie
  2006-05-03 18:14     ` Keith Thompson
  0 siblings, 2 replies; 6+ messages in thread
From: evangeli @ 2006-05-03 16:37 UTC (permalink / raw)


thanks for the links
1 - i'd rather use some other library. if there is no other way a
/usr/bin/diff should do it.
2 - i meant the creation time. is the package
"Ada.Directories.Information" only ok for win32?




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: operations on files and directories
  2006-05-03 16:37   ` evangeli
@ 2006-05-03 16:54     ` Martin Dowie
  2006-05-03 21:18       ` Randy Brukardt
  2006-05-03 18:14     ` Keith Thompson
  1 sibling, 1 reply; 6+ messages in thread
From: Martin Dowie @ 2006-05-03 16:54 UTC (permalink / raw)


evangeli@cnam.fr wrote:
> thanks for the links
> 1 - i'd rather use some other library. if there is no other way a
> /usr/bin/diff should do it.
> 2 - i meant the creation time. is the package
> "Ada.Directories.Information" only ok for win32?

Depends on your compiler - the one on my website works fine for Win32.
Cheers
-- Martin



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: operations on files and directories
  2006-05-03 16:37   ` evangeli
  2006-05-03 16:54     ` Martin Dowie
@ 2006-05-03 18:14     ` Keith Thompson
  1 sibling, 0 replies; 6+ messages in thread
From: Keith Thompson @ 2006-05-03 18:14 UTC (permalink / raw)


"evangeli@cnam.fr" <evangeli@cnam.fr> writes:
> thanks for the links
> 1 - i'd rather use some other library. if there is no other way a
> /usr/bin/diff should do it.
> 2 - i meant the creation time. is the package
> "Ada.Directories.Information" only ok for win32?

Many operating systems (particularly Unix and relatives) don't record
the creation times of files.

-- 
Keith Thompson (The_Other_Keith) kst-u@mib.org  <http://www.ghoti.net/~kst>
San Diego Supercomputer Center             <*>  <http://users.sdsc.edu/~kst>
We must do something.  This is something.  Therefore, we must do this.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: operations on files and directories
  2006-05-03 16:54     ` Martin Dowie
@ 2006-05-03 21:18       ` Randy Brukardt
  0 siblings, 0 replies; 6+ messages in thread
From: Randy Brukardt @ 2006-05-03 21:18 UTC (permalink / raw)


"Martin Dowie" <martin.dowie@btopenworld.com> wrote in message
news:PamdnciF08LDfcXZnZ2dnUVZ8qadnZ2d@bt.com...
> > 2 - i meant the creation time. is the package
> > "Ada.Directories.Information" only ok for win32?
>
> Depends on your compiler - the one on my website works fine for Win32.

The standard suggests that an implementation provide a package
Ada.Directories.Information. It's doesn't specify what's in it.

The AARM gives recommended minimum implementations for Windows and Unix (and
Unix-like) systems. There are some commonalities, but for the most part
these things are target-dependent. That's because what's provided varies
from OS to OS. (And the purpose of this package is to provide convenient
access to those differences.)

Note that there is no Creation_Time routine in the recommended Unix version
of Ada.Directories.Information, because that information is not provided by
Unix systems. So your original problem is one that cannot be done portably,
simply because it can't be done at all on Unix. (Comparing
Modification_Times is always portable, and Last_Access_Time is provided by
both the Windows and Unix recommended packages, so that can usually be
compared as well. But not creation times).

As far as your first question goes, it's very rare that you would only want
to know if the files are the same; usually you would want to know where and
why they are different. Also, "the same" has different meanings for
different kinds of files -- strict binary comparison isn't always useful. So
it's usually necessary to write whatever it is that you need. (This is not
an operation which is commonly provided by predefined packages.)

                                       Randy.






^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2006-05-03 21:18 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-05-03 14:42 operations on files and directories evangeli
2006-05-03 16:22 ` Martin Dowie
2006-05-03 16:37   ` evangeli
2006-05-03 16:54     ` Martin Dowie
2006-05-03 21:18       ` Randy Brukardt
2006-05-03 18:14     ` Keith Thompson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox