From: David Empson on
Barry Margolin <barmar(a)alum.mit.edu> wrote:

> In article <hj0o4e$ui3$1(a)news.eternal-september.org>,
> Wes Groleau <Groleau+news(a)FreeShell.org> wrote:
>
> > Barry Margolin wrote:
> > > shine <useraddshine-nospam(a)gmail.com> wrote:
> > > It's not uncommon to include dates in filenames. E.g. "Expenses
> > > 1/16/2010".
> >
> > Since the format you suggest is not allowed
> > by 99% of the operating systems in use today,
> > I would say it is very "uncommon."
>
> There are 3 OSes in common use these days: Windows, Unix/Linux, and Mac
> OS X. I think 67% of them allow that filename.

33% (ignoring market share), and even then it depends where you are
using it. More like 5% if you take market/usage share into account.

"/" is not valid in Unix/Linux filenames as it is the pathname
separator.

"/" is not valid in Windows filenames as it can be used as a pathname
separator and is used by many tools to indicate an option parameter. You
can't store ":" on Windows file systems either - it is the separator
between the drive letter and pathname.

The Mac has two sets of rules.

GUI applications based on the Carbon APIs use ":" as a pathname
separator, and allow "/" to be used in filenames. (In some contexts, "/"
will be interpreted as a pathname separator.)

Applications based on the POSIX APIs (e.g. the BSD subsystem) use "/" as
a pathname separator, and allow ":" to be used in filenames.

The handling under the hood is interesting and varies depending on the
file system.

HFS works like the Carbon APIs - it allows "/" in a filename, but not
":".

UFS works like the POSIX APIs - it allows ":" in a filename, but not
"/".

(I think HFS+ is the same as HFS here.)

Mac OS X automatically translates between the API rules and file system
rules, converting "/" into ":" or vice versa as required.

The end result is that filenames containing "/" in the Mac GUI appear to
have ":" substituted in Terminal and similar contexts (and vice versa),
no matter which file system you use.

--
David Empson
dempson(a)actrix.gen.nz
From: Paul Sture on
In article <barmar-859BB8.20085417012010(a)nothing.attdns.com>,
Barry Margolin <barmar(a)alum.mit.edu> wrote:

> In article <jollyroger-05D7FD.14065017012010(a)news.individual.net>,
> Jolly Roger <jollyroger(a)pobox.com> wrote:
>
> >
> > For date sorting, I use these formats all the time:
> >
> > YYYYMMDD
> > YYYY-MM-DD
> >
> > Works great.
>
> The dash is a punctuation mark.

It's also a minus sign, which can lead to some truly bizarre results if
you muck up filename parsing in certain script languages.

--
Paul Sture
From: Paul Sture on
In article <0032fb12$0$25095$c3e8da3(a)news.astraweb.com>,
JF Mezei <jfmezei.spamnot(a)vaxination.ca> wrote:

> VAXman- @SendSpamHere.ORG wrote:
>
> >>1/16/2010".
> >
> > First day of the sixteenth month, gotcha.
>
>
> No, the 2010th day of the 16th month of year 1.

ISO style dates for me every time, so they sort in ascending order.

Here's some bash to produce file names with YYYY-MM-DD-HHMM

NOW=$(date +"%Y-%m-%d-%H%M")
TARFILE="$HOME/backups/accounts-$NOW.tar.gz"

And then you get into locales, currency symbols and comma or decimal
points, not to mention thousands separators. Much fun to be had :-)

And somewhat perversely, the only way I can persuade GnuCash to print
the correct currency for me is to run it with LANG=en_US.

--
Paul Sture
From: Jolly Roger on
In article <m2pr5819uk.fsf(a)revier.com>, Jochem Huhmann <joh(a)gmx.net>
wrote:

> Barry Margolin <barmar(a)alum.mit.edu> writes:
>
> >> > You might want to include dates in a sortable format:
> >> >
> >> > Quarterly Report 2009/01/01 - 2009/03/31
> >> > 2009/07/16 - Suzie's birthday party
> >>
> >> For date sorting, I use these formats all the time:
> >>
> >> YYYYMMDD
> >> YYYY-MM-DD
> >>
> >> Works great.
> >
> > The dash is a punctuation mark.
>
> It's one that works in all file systemy, though. And YYYY-MM-DD has the
> advantage of not only being easily sortable but also being an actual ISO
> standard (ISO 8601) and pretty much unambiguous in most of the world.
> And commonly used in internal/formal date definitions in software and
> data formats.
>
> http://en.wikipedia.org/wiki/ISO_8601

Yep! ...which is precisely why I have standardized on it.

--
Send responses to the relevant news group rather than email to me.
E-mail sent to this address may be devoured by my very hungry SPAM
filter. Due to Google's refusal to prevent spammers from posting
messages through their servers, I often ignore posts from Google
Groups. Use a real news client if you want me to see your posts.

JR
From: Warren Oates on
In article <paul.nospam-8041E4.13054118012010(a)pbook.sture.ch>,
Paul Sture <paul.nospam(a)sture.ch> wrote:

> ISO style dates for me every time, so they sort in ascending order.
>
> Here's some bash to produce file names with YYYY-MM-DD-HHMM
>
> NOW=$(date +"%Y-%m-%d-%H%M")
> TARFILE="$HOME/backups/accounts-$NOW.tar.gz"

The validation cops like this kind of thing:

2010-01-18T09:27:57-05:00

True -- that's how they want you to do dates in xml stuff; there's a
whole bunch of duration/period arithmetic lets you get it to CCYY-MM-DD.
Fortunately, php5 has a constant that produces it. It's certainly
sortable.
--
Very old woody beets will never cook tender.
-- Fannie Farmer