Web Images News Groups Scholar Blogs Gmail more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Sorting files by month
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  7 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Ed  
View profile  
 More options Oct 31, 6:10 pm
Newsgroups: microsoft.public.scripting.vbscript
From: Ed <E...@discussions.microsoft.com>
Date: Sat, 31 Oct 2009 11:10:01 -0700
Local: Sat, Oct 31 2009 6:10 pm
Subject: Sorting files by month
How would you write a script to sort files by month. For example a file named
January 1, February 13, March 27, etc. I have a folder that has files in it
with a daily log for each day. Each file is called Aug. 1, 09; Aug. 2, 09,
etc., Sept. 1, Oct. 1, 09. How would I sort them by month, day, year. Please
be detail with answer since I am new to scripting. Any where can I get more
info.
--
Ed

    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Paul Randall  
View profile  
 More options Oct 31, 8:21 pm
Newsgroups: microsoft.public.scripting.vbscript
From: "Paul Randall" <paulr...@cableone.net>
Date: Sat, 31 Oct 2009 13:21:46 -0700
Local: Sat, Oct 31 2009 8:21 pm
Subject: Re: Sorting files by month

"Ed" <E...@discussions.microsoft.com> wrote in message

news:0865DB3F-4E20-46B1-9495-1DAEE383CDF3@microsoft.com...

> How would you write a script to sort files by month. For example a file
> named
> January 1, February 13, March 27, etc. I have a folder that has files in
> it
> with a daily log for each day. Each file is called Aug. 1, 09; Aug. 2, 09,
> etc., Sept. 1, Oct. 1, 09. How would I sort them by month, day, year.
> Please
> be detail with answer since I am new to scripting. Any where can I get
> more
> info.

First, you have to be clearer on what you mean.  One person might think that
you want them sorted in this order when you look at them (the names of the
files) in a folder explorer window.  Another person might think you want
them sorted this way when their names are listed in an Excel table or in a
web page or printed on paper.  Someone else might think you want the files
physically moved around on the hard drive to be placed in this order.  You
might mean something entirely different.

-Paul Randall


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
James Watkins  
View profile  
 More options Oct 31, 9:27 pm
Newsgroups: microsoft.public.scripting.vbscript
From: "James Watkins" <some...@microsoft.com>
Date: Sun, 1 Nov 2009 08:27:51 +1100
Local: Sat, Oct 31 2009 9:27 pm
Subject: Re: Sorting files by month

"Ed" <E...@discussions.microsoft.com> wrote in message

news:0865DB3F-4E20-46B1-9495-1DAEE383CDF3@microsoft.com...

> How would you write a script to sort files by month. For example a file
> named
> January 1, February 13, March 27, etc. I have a folder that has files in
> it
> with a daily log for each day. Each file is called Aug. 1, 09; Aug. 2, 09,
> etc., Sept. 1, Oct. 1, 09. How would I sort them by month, day, year.
> Please
> be detail with answer since I am new to scripting. Any where can I get
> more
> info.
> --
> Ed

After following Paul's suggestions, consider downloading the VB Script help
file script56.chm from
http://www.microsoft.com/downloads/details.aspx?familyid=01592C48-207...
so that you can write at least some of the code yourself rather than holding
out an empty hand and asking someone to do all the work for you. You might
also view the posts in this newsgroup - there are lots of scripting examples
here.

    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Dr J R Stockton  
View profile  
 More options Nov 1, 5:11 pm
Newsgroups: microsoft.public.scripting.vbscript
From: Dr J R Stockton <reply0...@merlyn.demon.co.uk>
Date: Sun, 1 Nov 2009 17:11:43 +0000
Local: Sun, Nov 1 2009 5:11 pm
Subject: Re: Sorting files by month
In microsoft.public.scripting.vbscript message <0865DB3F-4E20-46B1-9495-
1DAEE383C...@microsoft.com>, Sat, 31 Oct 2009 11:10:01, Ed
<E...@discussions.microsoft.com> posted:

>How would you write a script to sort files by month. For example a file named
>January 1, February 13, March 27, etc. I have a folder that has files in it
>with a daily log for each day. Each file is called Aug. 1, 09; Aug. 2, 09,
>etc., Sept. 1, Oct. 1, 09. How would I sort them by month, day, year. Please
>be detail with answer since I am new to scripting. Any where can I get more
>info.

I would do it mainly by pressing keys.

Such programming tasks are much easier if dates (and times) are all
given in ISO 8601 form ; it is at present 2009-11-01 17:11 GMT.

--
 (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.


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
mayayana  
View profile  
 More options Nov 1, 6:52 pm
Newsgroups: microsoft.public.scripting.vbscript
From: "mayayana" <mayaXXy...@rcXXn.com>
Date: Sun, 1 Nov 2009 13:52:36 -0500
Local: Sun, Nov 1 2009 6:52 pm
Subject: Re: Sorting files by month
  James Watkins provided a link to the scripting help.
Once you have that, see the FileSystemObject (FSO).
With FSO you can access a folder and its files as
objects. Each file has a Name property. Then there's
a Split function that will return an array from a string,
based on delimiters.
   Say you have the file Oct. 1, 09 and you return its
name. Then you could do the following to simplify
the operation:

sName = Replace(sName, ",", "") ' remove comma
sName = Replace(sName, ".", "") ' remove period.
AName = Split(sName, " ")

That will split sName into an array by splitting it at
each space. The result will be:

AName(0) = "Oct"
AName(1) = "1"
AName(2) = "09"

Once you have that array it's easy to sort the items:

sMonth = AName(0)
Select Case sMonth
   Case "Jan"

   Case "Feb"

   ' ...etc....
End Select

  That should be enough info., along with the help
file, to work out the details of the sorting. It's hard
to make it more clear without just writing your
whole script for you.


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Todd Vargo  
View profile  
 More options Nov 2, 5:19 am
Newsgroups: microsoft.public.scripting.vbscript
From: "Todd Vargo" <tlva...@sbcglobal.netz>
Date: Mon, 2 Nov 2009 00:19:25 -0500
Local: Mon, Nov 2 2009 5:19 am
Subject: Re: Sorting files by month

Ed wrote:
> How would you write a script to sort files by month. For example a
> file named January 1, February 13, March 27, etc. I have a folder
> that has files in it with a daily log for each day. Each file is
> called Aug. 1, 09; Aug. 2, 09, etc., Sept. 1, Oct. 1, 09. How would I
> sort them by month, day, year. Please be detail with answer since I
> am new to scripting. Any where can I get more info.

Since the daily logs are presumed to be saved on the respective dates
mentioned, I would just click on "Modified" at the top of the date column in
Explorer to sort them by date. No scripting needed.

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


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
gimme_this_gimme_that@yah oo.com  
View profile  
 More options Nov 5, 11:32 pm
Newsgroups: microsoft.public.scripting.vbscript
From: "gimme_this_gimme_t...@yahoo.com" <gimme_this_gimme_t...@yahoo.com>
Date: Thu, 5 Nov 2009 15:32:32 -0800 (PST)
Local: Thurs, Nov 5 2009 11:32 pm
Subject: Re: Sorting files by month
If you rename the files using YYYYMMDD format the files will sort
themselves.

    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google