How to Sort on Date in Filename?

I have files whose filenames include date created; with the filename 
format ddmmmfilename2, ddmmmfilename3, etc in a folder.

In Windows Explorer I want to view the files in date sequence. How can I 
manipulate the ddmmm into a format that can be logically sorted?

thanks

Davy
0
Davy
1/3/2010 5:28:22 PM
scripting.vbscript 564 articles. 0 followers. Follow

12 Replies
1374 Views

Similar Articles

[PageSpeed] 38


"Davy" <me@removeallthistextchobham.org.uk> said this in news item 
news:Xns9CF5B1C1ADEC1meremoveallthistextc@216.196.109.145...
> I have files whose filenames include date created; with the filename
> format ddmmmfilename2, ddmmmfilename3, etc in a folder.
>
> In Windows Explorer I want to view the files in date sequence. How can I
> manipulate the ddmmm into a format that can be logically sorted?
>
> thanks
>
> Davy

Since you specifically mention Windows Explorer, I think you're posting in 
the wrong group. This group focuses on VB Scripting. A Windows XP (?) or a 
Windows file system newsgroup may be a better place. Anyway, since you named 
your files ddmmmFilename you have three options:
- Sort by dd (which is probably useless)
- Sort by file date, by clicking the file date column header in Explorer.
- Rename the files to yyyymmddFilename (where mm is the month *number*, not 
name). 

0
Pegasus
1/3/2010 7:20:59 PM
"Pegasus [MVP]" <news@microsoft.com> wrote in
news:#I8TjnKjKHA.4048@TK2MSFTNGP06.phx.gbl: 

> "Davy" <me@removeallthistextchobham.org.uk> said this in news item 
> news:Xns9CF5B1C1ADEC1meremoveallthistextc@216.196.109.145...
>> I have files whose filenames include date created; with the 
filename
>> format ddmmmfilename2, ddmmmfilename3, etc in a folder.
>>
>> In Windows Explorer I want to view the files in date sequence. How
>> can I manipulate the ddmmm into a format that can be logically
>> sorted? 
>>
>> thanks
>>
>> Davy
> 
> Since you specifically mention Windows Explorer, I think you're
> posting in the wrong group. This group focuses on VB Scripting. A
> Windows XP (?) or a Windows file system newsgroup may be a better
> place. Anyway, since you named your files ddmmmFilename you have 
three
> options: - Sort by dd (which is probably useless)
> - Sort by file date, by clicking the file date column header in
> Explorer. - Rename the files to yyyymmddFilename (where mm is the
> month *number*, not name). 
> 
> 

Pegasus, thanks for the prompt reply. I now realise that my post was 
not as clear as I imagined.
Although I want to use Windows Explorer to view the list of files, I 
want to use VBS to rename the files so that they can be sorted 
meaningfully by date.
There are too many files to rename manually.
Unfortunately the files' 'date created' property does not reflect the 
date created; just the date these files were placed into their current 
context.
I realise that I could write some VBS script along the lines of;
if mmm is 'Dec' then replace with '12', etc, etc. Then reformat date 
to mmdd so can be meaningfully sorted.
But I had hoped that there might be a VBS function that can parse a 
date in the format ddmmm and recognise it and then another function to 
convert it to a format that can be put into a file name for sorting.

Hope this makes sense, my VBS knowledge is somewhat limited.

cheers, DAvy
0
Davy
1/4/2010 9:39:00 AM

"Davy" <me@removeallthistextchobham.org.uk> said this in news item 
news:Xns9CF6622D5830Fmeremoveallthistextc@216.196.109.145...
> "Pegasus [MVP]" <news@microsoft.com> wrote in
> news:#I8TjnKjKHA.4048@TK2MSFTNGP06.phx.gbl:
>
>> "Davy" <me@removeallthistextchobham.org.uk> said this in news item
>> news:Xns9CF5B1C1ADEC1meremoveallthistextc@216.196.109.145...
>>> I have files whose filenames include date created; with the
> filename
>>> format ddmmmfilename2, ddmmmfilename3, etc in a folder.
>>>
>>> In Windows Explorer I want to view the files in date sequence. How
>>> can I manipulate the ddmmm into a format that can be logically
>>> sorted?
>>>
>>> thanks
>>>
>>> Davy
>>
>> Since you specifically mention Windows Explorer, I think you're
>> posting in the wrong group. This group focuses on VB Scripting. A
>> Windows XP (?) or a Windows file system newsgroup may be a better
>> place. Anyway, since you named your files ddmmmFilename you have
> three
>> options: - Sort by dd (which is probably useless)
>> - Sort by file date, by clicking the file date column header in
>> Explorer. - Rename the files to yyyymmddFilename (where mm is the
>> month *number*, not name).
>>
>>
>
> Pegasus, thanks for the prompt reply. I now realise that my post was
> not as clear as I imagined.
> Although I want to use Windows Explorer to view the list of files, I
> want to use VBS to rename the files so that they can be sorted
> meaningfully by date.
> There are too many files to rename manually.
> Unfortunately the files' 'date created' property does not reflect the
> date created; just the date these files were placed into their current
> context.
> I realise that I could write some VBS script along the lines of;
> if mmm is 'Dec' then replace with '12', etc, etc. Then reformat date
> to mmdd so can be meaningfully sorted.
> But I had hoped that there might be a VBS function that can parse a
> date in the format ddmmm and recognise it and then another function to
> convert it to a format that can be put into a file name for sorting.
>
> Hope this makes sense, my VBS knowledge is somewhat limited.
>
> cheers, DAvy

OK, I got misled by your subject line. It seems you wish to "rename" rather 
than to "sort" your files. If you put the words "bulk rename" into a Google 
search box then you will get a large number of hits for renaming tools, many 
of the free. Some might actually do exactly what you want to do.

If you can't find one then the File System Object has methods to do this. 
The following code fragment illustrates the concept:
Set oFSO = CreateObject("Scripting.FileSystemObject")
dDate = oFSO.GetFile("d:\tools\att.vbs").DateLastModified
WScript.Echo Year(dDate), Month(dDate), Day(dDate)

You would need to write a script that enumerates every file in the folder 
and renames it with the rename method of the File System Object. Remember to 
pad your days and months with a leading zero if necessary and to deal with 
the case where two files might get the same name. 

0
Pegasus
1/4/2010 10:25:30 AM
"Pegasus [MVP]" <news@microsoft.com> wrote in
news:OZaEAhSjKHA.5604@TK2MSFTNGP04.phx.gbl: 

> "Davy" <me@removeallthistextchobham.org.uk> said this in news item 
> news:Xns9CF6622D5830Fmeremoveallthistextc@216.196.109.145...
>> "Pegasus [MVP]" <news@microsoft.com> wrote in
>> news:#I8TjnKjKHA.4048@TK2MSFTNGP06.phx.gbl:
>>
>>> "Davy" <me@removeallthistextchobham.org.uk> said this in news item
>>> news:Xns9CF5B1C1ADEC1meremoveallthistextc@216.196.109.145...
>>>> I have files whose filenames include date created; with the
>> filename
>>>> format ddmmmfilename2, ddmmmfilename3, etc in a folder.
>>>>
>>>> In Windows Explorer I want to view the files in date sequence. 
How
>>>> can I manipulate the ddmmm into a format that can be logically
>>>> sorted?
>>>>
>>>> thanks
>>>>
>>>> Davy
>>>
>>> Since you specifically mention Windows Explorer, I think you're
>>> posting in the wrong group. This group focuses on VB Scripting. A
>>> Windows XP (?) or a Windows file system newsgroup may be a better
>>> place. Anyway, since you named your files ddmmmFilename you have
>> three
>>> options: - Sort by dd (which is probably useless)
>>> - Sort by file date, by clicking the file date column header in
>>> Explorer. - Rename the files to yyyymmddFilename (where mm is the
>>> month *number*, not name).
>>>
>>>
>>
>> Pegasus, thanks for the prompt reply. I now realise that my post 
was
>> not as clear as I imagined.
>> Although I want to use Windows Explorer to view the list of files, 
I
>> want to use VBS to rename the files so that they can be sorted
>> meaningfully by date.
>> There are too many files to rename manually.
>> Unfortunately the files' 'date created' property does not reflect 
the
>> date created; just the date these files were placed into their
>> current context.
>> I realise that I could write some VBS script along the lines of;
>> if mmm is 'Dec' then replace with '12', etc, etc. Then reformat 
date
>> to mmdd so can be meaningfully sorted.
>> But I had hoped that there might be a VBS function that can parse a
>> date in the format ddmmm and recognise it and then another function
>> to convert it to a format that can be put into a file name for
>> sorting. 
>>
>> Hope this makes sense, my VBS knowledge is somewhat limited.
>>
>> cheers, DAvy
> 
> OK, I got misled by your subject line. It seems you wish to "rename"
> rather than to "sort" your files. If you put the words "bulk rename"
> into a Google search box then you will get a large number of hits 
for
> renaming tools, many of the free. Some might actually do exactly 
what
> you want to do. 
> 
> If you can't find one then the File System Object has methods to do
> this. The following code fragment illustrates the concept:
> Set oFSO = CreateObject("Scripting.FileSystemObject")
> dDate = oFSO.GetFile("d:\tools\att.vbs").DateLastModified
> WScript.Echo Year(dDate), Month(dDate), Day(dDate)
> 
> You would need to write a script that enumerates every file in the
> folder and renames it with the rename method of the File System
> Object. Remember to pad your days and months with a leading zero if
> necessary and to deal with the case where two files might get the 
same
> name. 
> 
> 

Pegasus, thanks for the suggestions.
I have several file-renaming pieces of software - non of which have 
sufficient logic to do what I want.
Regarding your code fragment; the DateLastModified is useless to me 
since I need the date of original creation of the file; which is 
recorded in the filename in the format ddmmmfilename1 etc.

So I need to take the ddmmm part of the filename and re-insert it back 
into the file name in the format mmddfilename1 etc. Obviously I can do 
this with some clumsy manipulation along the lines of:
if mmm is 'Dec' then replace with '12', etc, etc. Then reformat date

but I was hoping to find out if there was some clever date recognition 
function in VBS

cheeers

DAvy
0
Davy
1/4/2010 11:03:51 AM
Davy wrote:
> "Pegasus [MVP]" <news@microsoft.com> wrote in
> news:OZaEAhSjKHA.5604@TK2MSFTNGP04.phx.gbl:
>
>> "Davy" <me@removeallthistextchobham.org.uk> said this in news item
>> news:Xns9CF6622D5830Fmeremoveallthistextc@216.196.109.145...
>>> "Pegasus [MVP]" <news@microsoft.com> wrote in
>>> news:#I8TjnKjKHA.4048@TK2MSFTNGP06.phx.gbl:
>>>
>>>> "Davy" <me@removeallthistextchobham.org.uk> said this in news item
>>>> news:Xns9CF5B1C1ADEC1meremoveallthistextc@216.196.109.145...
>>>>> I have files whose filenames include date created; with the
>>>>> filename format ddmmmfilename2, ddmmmfilename3, etc in a folder.
>>>>>
>>>>> In Windows Explorer I want to view the files in date sequence. How
>>>>> can I manipulate the ddmmm into a format that can be logically
>>>>> sorted?
>>>>>
>>>>> thanks
>>>>>
>>>>> Davy
>>>>
>>>> Since you specifically mention Windows Explorer, I think you're
>>>> posting in the wrong group. This group focuses on VB Scripting. A
>>>> Windows XP (?) or a Windows file system newsgroup may be a better
>>>> place. Anyway, since you named your files ddmmmFilename you have
>>>> three options: - Sort by dd (which is probably useless)
>>>> - Sort by file date, by clicking the file date column header in
>>>> Explorer. - Rename the files to yyyymmddFilename (where mm is the
>>>> month *number*, not name).
>>>>
>>>>
>>>
>>> Pegasus, thanks for the prompt reply. I now realise that my post was
>>> not as clear as I imagined.
>>> Although I want to use Windows Explorer to view the list of files, I
>>> want to use VBS to rename the files so that they can be sorted
>>> meaningfully by date.
>>> There are too many files to rename manually.
>>> Unfortunately the files' 'date created' property does not reflect
>>> the date created; just the date these files were placed into their
>>> current context.
>>> I realise that I could write some VBS script along the lines of;
>>> if mmm is 'Dec' then replace with '12', etc, etc. Then reformat date
>>> to mmdd so can be meaningfully sorted.
>>> But I had hoped that there might be a VBS function that can parse a
>>> date in the format ddmmm and recognise it and then another function
>>> to convert it to a format that can be put into a file name for
>>> sorting.
>>>
>>> Hope this makes sense, my VBS knowledge is somewhat limited.
>>>
>>> cheers, DAvy
>>
>> OK, I got misled by your subject line. It seems you wish to "rename"
>> rather than to "sort" your files. If you put the words "bulk rename"
>> into a Google search box then you will get a large number of hits for
>> renaming tools, many of the free. Some might actually do exactly what
>> you want to do.
>>
>> If you can't find one then the File System Object has methods to do
>> this. The following code fragment illustrates the concept:
>> Set oFSO = CreateObject("Scripting.FileSystemObject")
>> dDate = oFSO.GetFile("d:\tools\att.vbs").DateLastModified
>> WScript.Echo Year(dDate), Month(dDate), Day(dDate)
>>
>> You would need to write a script that enumerates every file in the
>> folder and renames it with the rename method of the File System
>> Object. Remember to pad your days and months with a leading zero if
>> necessary and to deal with the case where two files might get the
>> same name.
>>
>>
>
> Pegasus, thanks for the suggestions.
> I have several file-renaming pieces of software - non of which have
> sufficient logic to do what I want.
> Regarding your code fragment; the DateLastModified is useless to me
> since I need the date of original creation of the file; which is
> recorded in the filename in the format ddmmmfilename1 etc.
>
> So I need to take the ddmmm part of the filename and re-insert it back
> into the file name in the format mmddfilename1 etc. Obviously I can do
> this with some clumsy manipulation along the lines of:
> if mmm is 'Dec' then replace with '12', etc, etc. Then reformat date
>
> but I was hoping to find out if there was some clever date recognition
> function in VBS
>
Nope. You're on your own there. But it isn't that hard given that the namers 
of the files were faithful to this format. Simple string functions (Mid, 
Right and Left) will carry you through.

-- 
Microsoft MVP - ASP/ASP.NET - 2004-2007
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM" 


0
Bob
1/4/2010 11:37:12 AM

"Davy" <me@removeallthistextchobham.org.uk> said this in news item 
news:Xns9CF6708FE96ACmeremoveallthistextc@216.196.109.145...
> "Pegasus [MVP]" <news@microsoft.com> wrote in
> news:OZaEAhSjKHA.5604@TK2MSFTNGP04.phx.gbl:
>
>> "Davy" <me@removeallthistextchobham.org.uk> said this in news item
>> news:Xns9CF6622D5830Fmeremoveallthistextc@216.196.109.145...
>>> "Pegasus [MVP]" <news@microsoft.com> wrote in
>>> news:#I8TjnKjKHA.4048@TK2MSFTNGP06.phx.gbl:
>>>
>>>> "Davy" <me@removeallthistextchobham.org.uk> said this in news item
>>>> news:Xns9CF5B1C1ADEC1meremoveallthistextc@216.196.109.145...
>>>>> I have files whose filenames include date created; with the
>>> filename
>>>>> format ddmmmfilename2, ddmmmfilename3, etc in a folder.
>>>>>
>>>>> In Windows Explorer I want to view the files in date sequence.
> How
>>>>> can I manipulate the ddmmm into a format that can be logically
>>>>> sorted?
>>>>>
>>>>> thanks
>>>>>
>>>>> Davy
>>>>
>>>> Since you specifically mention Windows Explorer, I think you're
>>>> posting in the wrong group. This group focuses on VB Scripting. A
>>>> Windows XP (?) or a Windows file system newsgroup may be a better
>>>> place. Anyway, since you named your files ddmmmFilename you have
>>> three
>>>> options: - Sort by dd (which is probably useless)
>>>> - Sort by file date, by clicking the file date column header in
>>>> Explorer. - Rename the files to yyyymmddFilename (where mm is the
>>>> month *number*, not name).
>>>>
>>>>
>>>
>>> Pegasus, thanks for the prompt reply. I now realise that my post
> was
>>> not as clear as I imagined.
>>> Although I want to use Windows Explorer to view the list of files,
> I
>>> want to use VBS to rename the files so that they can be sorted
>>> meaningfully by date.
>>> There are too many files to rename manually.
>>> Unfortunately the files' 'date created' property does not reflect
> the
>>> date created; just the date these files were placed into their
>>> current context.
>>> I realise that I could write some VBS script along the lines of;
>>> if mmm is 'Dec' then replace with '12', etc, etc. Then reformat
> date
>>> to mmdd so can be meaningfully sorted.
>>> But I had hoped that there might be a VBS function that can parse a
>>> date in the format ddmmm and recognise it and then another function
>>> to convert it to a format that can be put into a file name for
>>> sorting.
>>>
>>> Hope this makes sense, my VBS knowledge is somewhat limited.
>>>
>>> cheers, DAvy
>>
>> OK, I got misled by your subject line. It seems you wish to "rename"
>> rather than to "sort" your files. If you put the words "bulk rename"
>> into a Google search box then you will get a large number of hits
> for
>> renaming tools, many of the free. Some might actually do exactly
> what
>> you want to do.
>>
>> If you can't find one then the File System Object has methods to do
>> this. The following code fragment illustrates the concept:
>> Set oFSO = CreateObject("Scripting.FileSystemObject")
>> dDate = oFSO.GetFile("d:\tools\att.vbs").DateLastModified
>> WScript.Echo Year(dDate), Month(dDate), Day(dDate)
>>
>> You would need to write a script that enumerates every file in the
>> folder and renames it with the rename method of the File System
>> Object. Remember to pad your days and months with a leading zero if
>> necessary and to deal with the case where two files might get the
> same
>> name.
>>
>>
>
> Pegasus, thanks for the suggestions.
> I have several file-renaming pieces of software - non of which have
> sufficient logic to do what I want.
> Regarding your code fragment; the DateLastModified is useless to me
> since I need the date of original creation of the file; which is
> recorded in the filename in the format ddmmmfilename1 etc.
>
> So I need to take the ddmmm part of the filename and re-insert it back
> into the file name in the format mmddfilename1 etc. Obviously I can do
> this with some clumsy manipulation along the lines of:
> if mmm is 'Dec' then replace with '12', etc, etc. Then reformat date
>
> but I was hoping to find out if there was some clever date recognition
> function in VBS
>
> cheeers
>
> DAvy

There are three date methods in the File System Object:
- DateLastModified
- DateLastAccessed
- DateCreated

I recommend you download the helpfile script56.chm from the Microsoft site 
to see the full details.

Depending on your exact setup you could also extract the day and month from 
the file name and the year from the DateCreated method. Translating month 
names into numbers is as clumsy or as elegant as you make it, e.g. like so:

Set dicMonths = CreateObject( "Scripting.Dictionary" )
aMonths = Split(LCase(" Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec"))
For i = 1 To 12
	if i < 10 then x = "0" & i Else x = i
	dicMonths.Add aMonths(i), x
Next
WScript.Echo "Month number = ", dicMonths(LCase("Mar"))
 

0
Pegasus
1/4/2010 12:49:50 PM
Davy wrote:
> So I need to take the ddmmm part of the filename and re-insert it back
> into the file name in the format mmddfilename1 etc. Obviously I can do
> this with some clumsy manipulation along the lines of:
> if mmm is 'Dec' then replace with '12', etc, etc. Then reformat date
>
> but I was hoping to find out if there was some clever date recognition
> function in VBS

You will have to create your own function. Feed the function an original
filename. Use the Mid function to extract the month and convert it to
numerals. Then construct the new name and return it to the function.

Function ddmmm2mmdd(filename)
  mm = Right("0" & Month(Mid(filename, 3, 3) & "/1/00"), 2)
  ddmmm2mmdd = Left(filename, 2) & mm & Mid(filename, 6)
End Function

Now you simply use the new function in a loop.

f.Name = ddmmm2mmdd(f.Name)

-- 
Todd Vargo
(Post questions to group only. Remove "z" to email personal messages)

0
Todd
1/4/2010 11:25:25 PM
Todd Vargo wrote:
> Davy wrote:
> > So I need to take the ddmmm part of the filename and re-insert it back
> > into the file name in the format mmddfilename1 etc. Obviously I can do
> > this with some clumsy manipulation along the lines of:
> > if mmm is 'Dec' then replace with '12', etc, etc. Then reformat date
> >
> > but I was hoping to find out if there was some clever date recognition
> > function in VBS
> 
> You will have to create your own function. Feed the function an original
> filename. Use the Mid function to extract the month and convert it to
> numerals. Then construct the new name and return it to the function.
> 
> Function ddmmm2mmdd(filename)
>   mm = Right("0" & Month(Mid(filename, 3, 3) & "/1/00"), 2)
>   ddmmm2mmdd = Left(filename, 2) & mm & Mid(filename, 6)

Oops, I forgot to move the month to the front of the filename.
Replace line above with this line.

  ddmmm2mmdd = mm & Left(filename, 2) & Mid(filename, 6)


> End Function
> 
> Now you simply use the new function in a loop.
> 
> f.Name = ddmmm2mmdd(f.Name)
> 
> -- 
> Todd Vargo
> (Post questions to group only. Remove "z" to email personal messages)
> 
0
Todd
1/5/2010 1:10:23 AM
Davy <me@removeallthistextchobham.org.uk> wrote in 
news:Xns9CF5B1C1ADEC1meremoveallthistextc@216.196.109.145:

> I have files whose filenames include date created; with the filename 
> format ddmmmfilename2, ddmmmfilename3, etc in a folder.
> 
> In Windows Explorer I want to view the files in date sequence. How can 
I 
> manipulate the ddmmm into a format that can be logically sorted?
> 
> thanks
> 
> Davy

Thanks guys for the suggestions; look elegant enough for me. I was 
expecting to write reams of 'if' statements...

I compromised with:

		Select Case dMonth
			Case "Jan"
				dMonth = "01"
			Case "Feb" 
				dMonth = "02"
etc

thanks

DAvy
0
Davy
1/5/2010 9:07:36 AM
> I compromised with:
>
> Select Case dMonth
> Case "Jan"
> dMonth = "01"
> Case "Feb"
> dMonth = "02"
> etc
>

    This is really just a matter of personal taste,
but if it were me I think I'd just change that to
a day-of-year method, and not even bother with
worrying about month lengths. Just add
(month x 31) + day-of-month to get a unique
number and add that to the file name.
  So 01FebAtTheLake.jpg becomes something
like 32-01FebAtTheLake.jpg. The files can then
be sorted in Explorer by name.


0
mayayana
1/5/2010 2:41:08 PM
In microsoft.public.scripting.vbscript message <Xns9CF6708FE96ACmeremove
allthistextc@216.196.109.145>, Mon, 4 Jan 2010 05:03:51, Davy <me@remove
allthistextchobham.org.uk> posted:
>So I need to take the ddmmm part of the filename and re-insert it back
>into the file name in the format mmddfilename1 etc. Obviously I can do
>this with some clumsy manipulation along the lines of:
>if mmm is 'Dec' then replace with '12', etc, etc. Then reformat date
>
>but I was hoping to find out if there was some clever date recognition
>function in VBS

Cleverness is not really required.  Consider :

Name = "12Marfilename2"
document.write CDate(Left(Name, 2) & " " + Mid(Name, 3, 3) & " 2000")

document.write because I test in a Web page; use WScript.echo in WSH.

That gives me "2000-03-12", because my WinXP system is set to use ISO
8601 dates.

The result of CDate can if you like be used as an argument for functions
year month day, if you cannot use ISO dates for their obvious advantages
(anything that sensible is Politically Incorrect between Canada &
Mexico, where you are apparently not) but use the European dd.mm.yyyy
with some separator, then you can dissect and reassemble the result of
CDate into Y M D order.

If you use one-digit dates before the 10th of the month (unwise), then
test the second character of the filename to recognise those and treat
accordingly.

                Caveat DatePart for Week Number as used
                in standards-respecting countries.

                                Chobham is not so far from here; watch
                                out for large cylinders falling nearby.

-- 
 (c) John Stockton, nr London, UK.    ?@merlyn.demon.co.uk     Turnpike v6.05.
 Web  <URL:http://www.merlyn.demon.co.uk/> - w. FAQish topics, links, acronyms
 PAS EXE etc : <URL:http://www.merlyn.demon.co.uk/programs/> - see 00index.htm
 Dates - miscdate.htm estrdate.htm js-dates.htm pas-time.htm critdate.htm etc.
0
Dr
1/5/2010 11:04:01 PM
Davy wrote:
> Davy <me@removeallthistextchobham.org.uk> wrote in
> news:Xns9CF5B1C1ADEC1meremoveallthistextc@216.196.109.145:
>
> > I have files whose filenames include date created; with the filename
> > format ddmmmfilename2, ddmmmfilename3, etc in a folder.
> >
> > In Windows Explorer I want to view the files in date sequence. How can
> I
> > manipulate the ddmmm into a format that can be logically sorted?
> >
> > thanks
> >
> > Davy
>
> Thanks guys for the suggestions; look elegant enough for me. I was
> expecting to write reams of 'if' statements...
>
> I compromised with:
>
> Select Case dMonth
> Case "Jan"
> dMonth = "01"
> Case "Feb"
> dMonth = "02"
> etc

Note, this method is case sensitive. Without modification, it will fail if
dMonth is jan or JAN, etc. The function that I posted yesterday changes
ddmmmfilename2 to mmddfilename2. Give it a try.

-- 
Todd Vargo
(Post questions to group only. Remove "z" to email personal messages)

0
Todd
1/6/2010 1:46:06 AM
Reply:

Similar Artilces:

datetimepicker finding the hours between two dates
Hello Just like the subject says I am using two datetimepickers a start and end and would like to know the hours between the two (or days). So far I have Private Sub calcHours() Dim totalHours As Integer 'totalHours = DateInitiatedDateTimePicker.Value.Day - DateFinishedDateTimePicker.Value.Day Dim startDate As DateTime = DateInitiatedDateTimePicker.Value Dim finishDate As DateTime = DateFinishedDateTimePicker.Value totalHours = startDate.Day + finishDate.Day 'totalHours = DateFinishedDateTimePicker.Value.Day - DateInitiate...

Looking up across date ranges in Access
I am mapping financial data from one system to another and need to look up in a query a dept based on a date range. tblDeptMap reads Dept FromDate To Date NewDept 1121 01/01/2009 31/03/2009 1125 1121 01/04/2009 31/05/2009 2332 Financial Data Table Looks Like this: Dept Month Year Amount 1121 01 2009 32 1121 02 2009 41 1121 03 2009 50 1121 04 2009 52 1121 05 2009 25 I need a query that will read: Dept Month Year Amount FinDate NewDept 1121 01 ...

ROWNUMBER and sort
I have a stored procedure (see below) that I want to insert records in order by BankSort, LastName, FirstName and also assign the check# in the same order using ROW_NUMBER OVER... The result I get is in the order WorkerLinkID and Week2Ending. How can I get this to work correctly? Thanks. INSERT INTO [MCFICore].[dbo].[PayChecks] ([CheckNumber] ,[CheckDate] ,[PeopleLinkID] ,[PeriodEnding] ,[EarnGross] ,[FICAExempt] ,[MedicareExempt] ,[StateTaxCode] ,[TaxFederal] ,[TaxFICA] ,[TaxMedicare] ,[TaxStat...

Date Formatting #5
How do you format a date field so that you don't need to enter the '/' between the month, date and year? We are getting the julian number when we enter a date. Thanks. Format it as text. >-----Original Message----- >How do you format a date field so that you don't need to >enter the '/' between the month, date and year? We are >getting the julian number when we enter a date. Thanks. >. > Check out: http://cpearson.com/excel/DateTimeEntry.htm In article <03a301c39f25$911ae0d0$a301280a@phx.gbl>, "mpavlina@sealy.com" <a...

Sorting #29
How do I sort a sheet (say 10 rows of 5 columns) into 1 row of 50 columns, where each 5 columns in the new single row is made up of the successive rows of 5 columns of the original data? I don't want to cut and paste. Cheers, B. Bod, What you're asking for isn't really a sort. Sort simply rearranges rows sequentially. A macro can rearrange the data. But I recommend you first look at what Excel tools you may be needing to use against this data (pivot tables, filtering, subtotaling, sorting...). If you'll give examples of what the data is, perhaps we can help. Set y...

Default Sort
How do I program Excel to Sort everything by the data in the 5th column automatically, by default Is that possible? or do I have to go in and sort it every time myself? Hi you may use the worksheet_change event to check if new data has been entered but I would recommend to sort manually -- Regards Frank Kabel Frankfurt, Germany Uly wrote: > How do I program Excel to Sort everything by the data in the 5th > column automatically, by default ? Is that possible? or do I have to > go in and sort it every time myself? Thank you Frank for responding! I will continue to do it manual...

How to find a cell with a particular date format?
Hi, For example, I have a cell that shows the date as 08/11/07. How can I use the Find command to locate it? TIA Tom Select that cell (just for testing). Look at the formulabar--not what's displayed in the cell. Use that when you try your Find. Tom wrote: > > Hi, > > For example, I have a cell that shows the date as 08/11/07. How can I use > the Find command to locate it? > > TIA > Tom -- Dave Peterson Ctrl-F, click on the Options>> button, then the Format... button. Leave search field empty to find all cells with ...

Sorting groups according to variance in excel
Hi everybody, let's see if someone can help me. I have a excel worksheet with a list of every movie that came out in 2008. The list is ordered by income of every movie, for example: Zorro 290,000 Benjamin Button 400,000 And so on. I have to divide the movies in four groups, and every group has to to have maximum omogeneity in the incomes. That is to say, the average variance of the incomes of every group has to be minimum. Somebody told me to use the Anova excel function from the add-ins. So i used the "anova: single factor" function. But the problem is tha...

sort sheet with Turkish Characters
I want to sort a column which contains turkish characters. A sample sort output is as follows: ab ça ce çg ia ıe öa oe The correct form should be ab ce ça çg ıe ia oe öa since ç comes after c, i comes after ı and ö comes after o. Please help me how to achieve this result. Thanks in advance Talat Oncu PS: Solution for Excel XP and Excel 2003 are welcome Microsoft sells a Turkish Language Pack for $25.00. However, I don't know whether the pack includes a sorting capability. see... http://buy.trymicrosoftoffice...

Sorting of Stock Name in Combo Box
I have 2 tables: 1 is Main stock code and the other is Main historical the primary key is stock code. I create a combo box in a form where the user can select the stock name. How could i sort the list from the pull down combo box from with asscending order? As i think access have sort the list using the stock code. where is it not Alphabetic in order if refer back to stock name. Pls help. Thank you Open the form in design view. Right-click the combo, and choose Properties. On the Data tab of the properties box, click RowSource. Click the Build button (...) beside the property. Access o...

how to keep adjacent rows linked when sorting with lists
I want to be able to select "sort ascending" or "sort descending" from the drop down menu on a list of dates that apply to a name e.g. list A list B gary 26/06/06 helen 23/06/06 greg 01/07/07 and have the names linked to the dates rather than just sort the dates as an individual column. Select the whole table (2 columns) before you sort on column B HTH -- AP "adaire" <adaire@discussions.microsoft.com> a �crit dans le message de news: 9E81BC07-CDB9-402E-9BA9-A20DBF7970EB@microsoft.com... >I want to be able to select "sort a...

Adding a KeyID column for sorting
Hi. I'm using MS Windows XP (Home) and Excel 2003. I have a worksheet with five columns and about 10,000 rows. I intend to do a lot of sorting on these columns. However, I want to be absolutely certain that the original order is always maintained (why I'm not using MS Access is a long story -- suffice it to say that I need to use Excel). So after I do a sort and perform a few tasks I want to click on a KeyID column and see the original order that I had before the sorting. Occasionally I will add a few rows of new material -- say between rows 100 and 120, or between 3330 an...

support retirement date for GP 9.0
Hello: I have heard that support for GP 10.0 will be continued until sometime in 2012, in keeping with Microsoft's 5-year support policy. Is there a firm mainstream support retirement date for GP 9.0? A client is trying to decide whether to upgrade to GP 9.0 or 10.0, and one of the items that will "make" him upgrade to 10.0 instead of 9.0 is the length of support. I think that 9.0 came out in 2006. So, if there is not a firm end date yet, does that mean that support will end sometime in 2011? Thanks! childofthe1980s Show him 10, show him all the sizzle, and explain th...

Automatically sort emails into excel spreadsheet
Hi there, I have a few batch files that run on my servers every night which then email me if they finish successfully. At the moment I have a rules wizard that moves those mails into appropriate folders but I would now like to be able to analyze those emails somehow and place a "YES" or "NO" into excel cells dependant on if an email exists or not. Here is an example: I run nightly defrag batches on my servers every night. I then get an email with a Subject line of "Defrag report: servername.domainname.local" and a message body of "Computer: servername.do...

Sorting and Header Row's
We work with a xls document on a daily basis, and the user's perform a repeated sort function on that document multiple times a day. Appearently, Excel used to save what you last sorted for and would also leave the "Header Row" circle checked, after you closed the app... Now, neither is saved... So I am just wondering if there is a way to have excel remember what was sorted last, how it was sorted and to sort it with a header row with out having to reset all those settings every time you do a sort...? Thanks! What version of Excel are you running? I have 2003 and it seems...

date format in excel not in line with control panel regional setti
I am running office professional 97 on windows XP platform and have a problem with excel date formats. The control panel regional settings in windows are set correctly to English ( united Kingdom ) with short date format of DD/MM/YYYY. when I apply format > cells in excel and select the date category the date formats presented appear to be in US format i.e. MM/DD/YYYY. and if applied to cells, the US date format is displayed. I have tried uninstalling and reinstalling excel, but problem still persists. In Access, the date formats are in the correct UK format and not US. Are there an...

Conditional formatting based on a date + 30 days
I've been looking at this all day and I'm sure there's a very simple answer, maybe a fresh pair of eyes might be able to help me out! I have a spreadsheet (in Excel 2003) which looks roughly like this: A B C 1 Sent Returned Overdue 2 10/12/05 04/01/06 3 20/12/05 4 12/10/05 What I want is, if the item hasn't been returned within 30 days of the sent date, the appropriate cell in the overdue column should turn red. But if it has been returned, or it's not due yet, the cell should stay blank (i.e. whi...

Merged Cells Prevent sorting
I'm trying to sort upon a given column and I get the error message stating that "Merged cells must be of the same size." I know what merged cells are, but the problem is, I cannot find ANY cells in the column in which I am sorting that are merged. So does this rule apply to ANY CELL in ANY column? If so, how do I bypass or shut off this feature so that I can perform what I thought was going to be a simple sorting of date on a single field? Select all the cells in the entire worksheet and in Format > Cells... clear the merge checkbox -- Gary's Student gsnu200706 ...

Change Date Format Within E-mail
While using the E-mail Template Manager, I notice the date format that comes in from the database is 2005-01- 12T00:00:00-05:00. I'm assuming this is GMT format. I would like to have this format modified to 12/01/2005. Is this possible? Please help ... This option is not available currently out of the box. Frank Lee Workopia, Inc. http://www.workopia.com/Links.htm San Francisco, CA "Jeff" wrote: > While using the E-mail Template Manager, I notice the > date format that comes in from the database is 2005-01- > 12T00:00:00-05:00. I'm assuming this is GMT f...

how to sort alphanumeric entries
Using Excel 2007 on Windows XP. We have a column of an assortment of alpha and numberic entries that won't sort properly. There must be a way to do this. Thanks for helping. For example: 1 2 3 28 29 106 106a 51a 51b Could you give some more examples of your range of values? If there is an alpha, will it only be a single character? If so, what is the range of letters that you might come across? Will you have a maximum of three numbers before the alpha? Pete On Aug 31, 9:58=A0pm, "Trainer" <as...@leydig.com> wrote: > Using Excel 2007 on Windows XP. =A0We have a ...

Problem with Date/Time Picker Format in Reports...
avalonsalesteam mackintoshcourtsalesteam viventisalesteam clive mont Pat 01616223030 Claire, can't access anything through anything excel.... 172.22.0.41 lch The monitoring software will notify us of any significant events that occur on the servers, such as failed services, errors, low disk space etc. will keep events, services, applications, logs, syslog, SNMP, WMI, websites, etc) that allows for the monitoring of any en Direct Line 08452461229 Claim No: 392 8074500 67193 darren london collin suttle transcribe kim from lqa 192.168.41.46 Hello all, I am having a...

Return a value when Date x is between Date y and z
Hi, I have a table something like this: A B C 1 From To Result 2 01/07/2009 01/07/2010 0-1 3 01/07/2010 01/07/2011 1-2 4 01/07/2011 01/07/2012 2-3 5 01/07/2012 01/07/2013 3-4 In another column (X) I have a list of Dates and I want return the "result" from the row where the date lies between. So for example in X3 I have 16/10/2011 and I can see this date is between the 2 dates in row 4 in the table above so I want to return "2-3" I've tried an array formula ...

Re:Pivot table sorting
hi, That did the trick. I just removed the total field from the "Row field" and kept only sum of total (data). With both the data in place sorting is not possible. thanks all Regards, Jimmy Joseph On 11 May 2006, you wrote in microsoft.public.excel: > Select a cell in the Total column, then click the Sort Descending > button (Z-A) on the Excel toolbar. ...

Ability to enter a invoice due date.
Why doesn't Great Pains allow for the entery of a due date for invoices? Currently you have to trick GP with an invoice date in the future. Also, why doesn't Great Pains have an Invoice Date field that isn't used to drive the posting period. The date keyed should drive the period that an invoice is posted too, while the invoice date should drive when the invoice is paid. Great Plains is the worst accounting system that I have ever seen. ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for...

match and sort two different tables
Column A has customer name, columns B,C,D has corresponding sales data for that month. Column E is blank. Column F has has customer name. Column G,H,I has the same corresponding sales data for the next month. Although Column A and F both have customer names, there are many changes month over month with the addition and deletion of certain customers so the rows do not match up exactly. Is there a quick way to have the rows match up according to customer names in column A and F and then sort them alpabetically? Maybe I'm missing something, but if customers are added/dele...