sobrique: (Default)
[personal profile] sobrique
OK. So if you're anything like me, you occasionally deal with log files.

Sometimes these log files are on systems which don't have anything remotely resembling a real shell.

So, here's a little snippet of usefulness:

for /F "tokens=1-3 delims=/ " %%v in ('date /T') do (
set day=%%v
set month=%%w
set year=%%x)

echo %year%%month%%day%

move D:\Legato\nsr\logs\daemon.log D:\Legato\nsr\logs\daemon.%year%%month%%day%.log



Lets me output a date in a format of YYYYMMDD, which is far more useful than most defaults because you get to sort by filename, in date order.

Date: 2008-04-16 06:08 pm (UTC)
From: [identity profile] mister-jack.livejournal.com
The awesome power of YYYYMMDD should be known to all programmers; hell, all computer users.

Date: 2008-04-16 06:42 pm (UTC)
From: [identity profile] sobrique.livejournal.com
I know it's such a _trival_ thing, but for bonus points it also gets away from the rather irritating ambiguity that is created by the moronic US date format.

Date: 2008-04-16 08:47 pm (UTC)
From: [identity profile] malal.livejournal.com
Seconded.

Profile

sobrique: (Default)
sobrique

December 2015

S M T W T F S
  12345
6789101112
13141516171819
20212223242526
2728 293031  

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Feb. 18th, 2026 11:31 am
Powered by Dreamwidth Studios