Solved

count files in a directory according to date modified

Posted on 2014-02-10
41
567 Views
Last Modified: 2014-02-12
Experts,
I am looking a tool that will help me count the number of files in a directory according to date modified.
Manually I am sorting the files by date modified, highlight the group of files for particular date, right clicking and checking properties.
Please help.
0
Comment
Question by:cpatelx
  • 16
  • 15
  • 9
  • +1
41 Comments
 
LVL 23

Expert Comment

by:Eirman
Comment Utility
An simple search with Directory Opus will do exactly what you want (You don't even need to use the advanced search).
Once you use it, you will never go back to Windows Explorer
http://www.gpsoft.com.au/
0
 
LVL 23

Expert Comment

by:Eirman
Comment Utility
Here is a demo result for one folder (and optional  subfolders) in only one location.
Modified after 1/8/2011
Result = 257
opus.JPG
0
 
LVL 51

Expert Comment

by:Joe Winograd, EE MVE
Comment Utility
Hi cpatelx,
I wrote an article (with a program) here at EE called Count and Total Size by File Type. I may be able to modify it to do what you want. I'm thinking of something like this:

Count by Modified DateBefore I even start the effort, I want to know if this is what you're looking for. If not, please post a mockup of what you'd like. No promises that I can do it, but I'll be happy to give it a look. Regards, Joe
0
 
LVL 8

Expert Comment

by:Amit Khilnaney
Comment Utility
Have you tried the group by feature


Create visual breaks for easy organization (Group by)

In addition to arranging and sorting, you can also group files by property. Like sorting, grouping won't significantly change the way files are displayed. It just breaks them into different sections, depending on which property you choose. So, if you have a folder full of text documents, you might want to group them by type to see which program was used to create them. Or, if you're dealing with photos, you can group them by date to separate them by the date they were taken.
To group your files by property

    Open the folder or library that you want to group.

    Right-click an empty space, point to Group by, and then click a property (such as Type).

    If you don't see the property you're looking for in the Group by menu, click More to add properties.

If you want to remove the grouping separation in a folder or library, just right-click an empty space, point to Group by, and then click (None).


Detailed Here for Win 7: http://windows.microsoft.com/en-in/windows7/arrange-sort-or-group-your-files
0
 

Author Comment

by:cpatelx
Comment Utility
Joe,
That would be perfect. I don't even need the size. I will just need to the modified date and count.
They are all pdf files.
0
 
LVL 23

Expert Comment

by:Eirman
Comment Utility
A final post on Directory Opus (I'm a real fan!)
You can see W:\SOFTWARE as the search location.
You can add as many locations as you want for a single search.

The 60 day trial is deliberately long so as you get you hooked.
The only negative is that it ain't cheap.
0
 
LVL 51

Expert Comment

by:Joe Winograd, EE MVE
Comment Utility
OK, I'll take a look at my code now to see if I can modify it for you. Give me an hour or so. Regards, Joe
0
 

Author Comment

by:cpatelx
Comment Utility
Thanks Joe

Thanks Eirman.. I  am trying Directory Opus. Only downside is that I would have to search each date to find out the number of files for that date.  

Also Thanks Amit - I tried the group by method and unfortunately it only group by today's date and groups the rest as 'Earlier this year'
0
 
LVL 51

Expert Comment

by:Joe Winograd, EE MVE
Comment Utility
cpatelx,
Do you want the counts to include subfolders? Regards, Joe
0
 
LVL 51

Expert Comment

by:Joe Winograd, EE MVE
Comment Utility
cpatelx,
Sorry for the bad one-hour estimate, but after looking at the code, I decided to go through with the modifications (and testing!), so the program is done now...took longer than I thought it would...sometimes taking out code is tougher than putting it in. :)

Forget that previous question — it was easy enough to make it in an option:

include subfolders promptBut here's a different question for you: do you want the date field in the spreadsheet to be text or date format? The program is working and right now the field is text, so the spreadsheet looks like this:

dates are text formatUnder the covers, the CSV has a value in those fields like this:

="20131205"

But I could make that:

=DATE(2013,12,05)

So the spreadsheet would look like this:

dates could be date formatWhich do you prefer? Regards, Joe
0
 

Author Comment

by:cpatelx
Comment Utility
Joe,
Thank you!  text format is fine. I also test the original script and it works good!

Once again thank you, this program will help me great deal.
0
 
LVL 51

Accepted Solution

by:
Joe Winograd, EE MVE earned 500 total points
Comment Utility
>  I also test the original script and it works good!

That's great news! Means I don't have to go through the whole AutoHotkey pitch. :)

The new script is attached. When you load the CSV file into Excel, I suggest doing an AutoFit Column Width for all columns.

This is new code (some of it) — I tested it well but it could have bugs, so you should test it carefully on some folders/subfolders where you validate the results manually...before turning it loose on a gazillion folders and files. :)

Let me know if you have any problems and I'll help you to troubleshoot.

Btw, in my previous article, I had a link to the original AutoHotkey language. But there have been several forks of the original language and the latest release recently moved to a new community. It comes with a Windows installer, as well as a compiler that turns the AHK source code (plain text) into a stand-alone/no-install executable (an EXE file). If you downloaded the original one, I recommend that you consider the one at the new community (but it's not necessary to run the attached script). Regards, Joe
File-Counts-by-Modified-Date.ahk
0
 

Author Closing Comment

by:cpatelx
Comment Utility
Thanks Joe
0
 

Author Comment

by:cpatelx
Comment Utility
I will do some testing now
0
 
LVL 51

Expert Comment

by:Joe Winograd, EE MVE
Comment Utility
You're welcome. Even though you closed the question, please post back here with the results of your testing...and the "production" runs! I'll be glad to help if you run into any issues. Regards, Joe
0
 

Author Comment

by:cpatelx
Comment Utility
Joe,
Would it too much effort to get the date format? Also, for the first results.. I am getting a prompt if to include sub folders and although selecting yes, it's not including sub folders.
Please help :)
0
 
LVL 51

Expert Comment

by:Joe Winograd, EE MVE
Comment Utility
I think I can do date format quickly — I'll look at it right now. I just tested subfolders here and it worked perfectly. Please re-download the script and try again.
0
 

Author Comment

by:cpatelx
Comment Utility
Yes! indeed it is including sub folders.. I apologize. I had to reread your post above regarding 'Date='2014,**,**'.
0
 

Author Comment

by:cpatelx
Comment Utility
Good results! I verified the count for about 10 dates thus far
0
 
LVL 51

Expert Comment

by:Joe Winograd, EE MVE
Comment Utility
OK, very relieved to hear that! I was getting worried, as it works fine here and couldn't understand why it wasn't for you. I'm working on a new version with the date format instead of text. Regards, Joe
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 51

Expert Comment

by:Joe Winograd, EE MVE
Comment Utility
Attached are two new versions (the file names make it clear which is which). One creates entries like this:

=DATE(2013,12,05)

The problem with the above is that you then have to format the cells to Date format.

The other one creates entries like this:

2013/12/05

Excel automatically formats these to Date format.

I can see pros and cons to each. Use whichever you prefer. Regards, Joe
File-Counts-DATE-formula.ahk
File-Counts-slash-format.ahk
0
 

Author Comment

by:cpatelx
Comment Utility
Thanks Joe! I have been testing both with good results. Although, I am wondering if the script can be modified to limit it to one day. For instance, if I provide an input date.. it would scan through the folders/subfolders and give me a count for files modified or created on that input date.

subfolder1= xxx (count)
subfolder2=xxx
etc

Please let me know your thoughts. Once again, I appreciate your help a great deal.
0
 
LVL 51

Expert Comment

by:Joe Winograd, EE MVE
Comment Utility
Glad to hear all of the scripts are working for you. Limiting it to one day is easy, but are you also asking that the count be reported by subfolder? That's not so easy. And are you now saying that the date stamp can be the Modified OR the Created date?
0
 

Author Comment

by:cpatelx
Comment Utility
Yes, reported by subfolder would help because we have one main folder with about 40 subfolders. each subfolder is brown down to year and another subfolder for months.

Sorry - Modified or created should not matter.
0
 
LVL 51

Expert Comment

by:Joe Winograd, EE MVE
Comment Utility
Give me an example of the names of the main folders and subfolders.
0
 

Author Comment

by:cpatelx
Comment Utility
Main folder are named 10,17,65...100,101... 200.
Inside each.. are subfolders named (by year) 2012,2013,2013
Inside those.. are subfolder named (by month) Jan, Feb, Mar.. etc

So, if I ask to get a count for 2/10/14

Each main folders should have a subfolder 2014..with another subfolder for FEB

Ideal Output I am looking for is

For 76 = *** on 2/10/14
       100= *** "     "
       101 =*** "     "

I hope that I am making sense..
0
 

Author Comment

by:cpatelx
Comment Utility
Joe, I am attaching an image as better example of the folder structure
folder structure
0
 
LVL 51

Expert Comment

by:Joe Winograd, EE MVE
Comment Utility
So an example folder is D:\76\2013\Jan\

Right? (Of course, D: is just an example...could be any drive.)
0
 
LVL 51

Expert Comment

by:Joe Winograd, EE MVE
Comment Utility
Our messages just crossed...that screenshot helps a lot.
0
 
LVL 23

Expert Comment

by:Eirman
Comment Utility
Why are you(plural) trying to design the wheel again!

Directory Opus does it all and so much more.
Try the Flat View of a folder structure just for starters.

I know it's a nice programming challenge .... but why?

(No offense intended ..... honest!)
0
 
LVL 51

Expert Comment

by:Joe Winograd, EE MVE
Comment Utility
> No offense intended ..... honest!

None taken. I hear you on Directory Opus. I've been using Total Commander for around 20 years (better than DOpus in my opinion, although I played with DOpus only for a short while, and I haven't tried it in recent years, as there's nothing I haven't been able to do with TC from a file management perspective; I'm sure in the hands of a DOpus expert like you it can do everything TC can). The thing is, sometimes a small, targeted effort that solves a specific problem is better for a user than learning a complex tool, like DOpus or TC. Some folks can manipulate their file managers like the back of their hands — not the case for all users.

For example, I have an updated version of the program posted here that contains a nicer UI, supporting radio buttons for inclusion of subfolders (yes/no) and a drop-down for the three choices of format for the CSV date cells. The UI looks like this:

file counts new guiIt does exactly what the user needs and is simple to use. Is it designing the wheel again? Maybe. Could this be done with DOpus or TC? Probably. But I don't think it would be as easy to use.

So, based on the asker's new question, can you describe the steps and/or post screenshots of output from DOpus that shows a date as input and then the count of files whose modified date matches the input date, with the count being shown for each folder, starting from a root folder and traversing all subfolders? Regards, Joe
0
 
LVL 23

Expert Comment

by:Eirman
Comment Utility
can you describe the steps and/or post screenshots of output from DOpus that shows a date as input and then the count of files whose modified date matches the input date, with the count being shown for each folder, starting from a root folder and traversing all subfolders?
I'll try
0
 
LVL 23

Expert Comment

by:Eirman
Comment Utility
It's much easier than I thought (It takes 20 seconds when you know how!) ....
I choose a lister output and to show a file count column.
Dopus Lister ViewI checked the results and nothing modified in 2012 or earlier is counted.

Instead of After I could have chosen On, Before, After, Between, Not Between, Within

I could easily have added a filter(s) and more root folders.
And this is a simple search. The advanced search allows one to combine multiple simple searches and to use more criteria (e.g. regular expressions) and save the search for future use.

I'm using Dopus 9 (10 is the latest).
I know 30% of the program and features so I am far from being a expert.
0
 

Author Comment

by:cpatelx
Comment Utility
I am  re-installing directory Opus. I will try the search method you mentioned above. I agree with ..it does exactly what the user needs and is simple to use. The new UI looks great!
I will have to familiarize myself with Directory Opus.. it does have many features and uses. I  will also try Total Commander!... And, I can't wait to try the new script with new UI :) this is all good information for me! Thank you.
0
 
LVL 23

Expert Comment

by:Eirman
Comment Utility
Here's a link for a 10% Discount
http://www.dearopus.com/opus-coupon.html

Comments by Total Commander users
http://resource.dopus.com/viewtopic.php?f=3&t=20283
0
 
LVL 51

Expert Comment

by:Joe Winograd, EE MVE
Comment Utility
Hi Eirman,
when you know how!
Yes, that's the key point for many folks! That said, your DOpus approach is very nice. Is it possible to feed the results into a CSV or Excel file, or even a plain text file?

I haven't been able to get TC to show the number of files in each folder that met the search criteria (the Files column in your screenshot). It may be doable, but...I don't know how. :)

Hi cpatelx,

Attached is the version with the new UI. Give it a spin and let me know how it works for you. After thinking about your new requirement for a bit, I don't believe that it is a simple change to the existing code...and one can spend only so much time working for free here at EE. :)  If you're happy with the DOpus solution for the new requirement, you're probably better off spending your money on that than a custom development, unless the UI is really critical for you. Regards, Joe
File-Counts-GUI.ahk
0
 

Author Comment

by:cpatelx
Comment Utility
Hi Joe,
Yes! output to CSV or Excel is awesome! Thank you I will run the new script. I completely understand regarding spending so much time. To be honest, I am not very familiar with DOpus, I am not able to replicate the results. The script is great. If there are any way, I would be happy to support your work and product.

Thank you... Chirag
0
 
LVL 23

Expert Comment

by:Eirman
Comment Utility
I am not able to replicate the results.
Make sure you are selecting "Lister Collection" in the top right rather than the default "find window"

I don't know if this terminology has been changed in ver10
0
 

Author Comment

by:cpatelx
Comment Utility
Hi Eirman,

I don't seem to have that option. I collection viewam only able to use "find results". Possibly, I need the full version.
0
 
LVL 51

Expert Comment

by:Joe Winograd, EE MVE
Comment Utility
Hi Chirag,
Thank you for offering to support my work and product. Please look in my EE profile and send me an email to discuss it. Regards, Joe
0
 
LVL 23

Expert Comment

by:Eirman
Comment Utility
They must have rearranged things in ver 10. This is what I see.
Ver 9There is another way .... Use the very useful Flat view
This shows all files in all folders & sub-folders in one long list.

VIEW > FLAT VIEW > Mixed (No Folders)
Show the "modified" column and sort
Select the files you want and look at the file count at the bottom.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

PaperPort (http://www.nuance.com/for-individuals/by-product/paperport/index.htm) is among the most important applications that I run on my Windows computers. I use it every day, for nearly all of my document and photo scanning, as well as most of my…
If you get continual lockouts after changing your Active Directory password, there are several possible reasons.  Two of the most common are using other devices to access your email and stored passwords in the credential manager of windows.
This Micro Tutorial will give you a introduction in two parts how to utilize Windows Live Movie Maker to its maximum capability. This will be demonstrated using Windows Live Movie Maker on Windows 7 operating system.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now