Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Name: Mechanix2Go
Since 'date math keeps coming up, I'll have a go.
It will be helpful if a few of you using NT/XP/vista run the bat below and post the first few lines. [Sorry, no good for Me/9x/DOS]
::=====================
@echo off > #for /f "tokens=* delims= " %%a in ('dir/b/a-d/o-d') do (
echo %%~TNa
)
=====================================
If at first you don't succeed, you're about average.M2

The first two lines of the output:
25/07/2008 17:45 #
25/07/2008 17:44 tI am using Windows XP and my locale is English, UK.

Thanks klint
I figured there would be 4 dig & 2 dig year.
Gotta see how many diff separators & DMD orderings.
=====================================
If at first you don't succeed, you're about average.M2

My first two lines of the output are
07/26/2008 04:53 #
07/26/2008 04:53 1I am using Windows XP and my locale is English, US.
Thanks,
Rudresh

date math for files like getting the modification date should be done in vbscript (for example) if you want it to be cross platform or to work in different M$ OS versions.

Thanks, Rudresh
Ghostdog, youre right, of course. Guess I need to learn VBS.
DH, That script look pretty neat; I'll study it.
=====================================
If at first you don't succeed, you're about average.M2

Hi ghostdog,
Dumb question of the day:
Does VBS work in w9x?
=====================================
If at first you don't succeed, you're about average.M2

yes
delete files older than 30 days
Dim fso
Dim oFolder
Dim oFileSet fso = createobject("Scripting.FileSystemObject")
Set oFolder = fso.GetFolder("C:\Temp")
For Each oFile In oFolder.files
If DateDiff("d", oFile.DateCreated,Now) > 30 Then
oFile.Delete True
End If
NextSet oFolder = Nothing
Set fso = Nothing

the version of the WSH engine in windows 98,2000 and millenium is either 1.0 or 2.0. You can download the latest version (think its 5.6) if you want to use vbs in those platforms. Its good to know about vbscript, since its the next best thing to DOS, natively.

Thanks gd & DH,
Got a link to 'VBS for dummies'? or similar
=====================================
If at first you don't succeed, you're about average.M2

You also got me and ghostdog here, if you need help.
Also, while learning VB*, I suggest you make your first line read Option Explicit.

here is a small contribution to the saga of date math
my output
29/07/2008 08.42 #
29/07/2008 08.42 dateWINDOWS XP, IT
curious to see how is ending up...
bye
max

Here's another output I've got today:
07/Tue/08/29 18:25 #
What sort of format is that? 07 is the month, 08 is the year, 29 is the day. Completely insane, I agree, but possible nevertheless.
How did I do that? Easily. I just went into Control Panel, Regional Settings, Customize... the date format is completely configurable.
Which proves there is an almost infinite number of possible formats for the date, and it is impossible to do it in batch.

Back when I ran Win98, I had my time set up as
-=:H.m:=-Why? because that's how it would be displayed on my task bar.

The difficult we do right away.
The impossible takes a little longer.
=====================================
If at first you don't succeed, you're about average.M2

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |