Solved

count files in a directory according to date modified

Posted on 2014-02-10
41
598 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
ID: 39848116
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
ID: 39848162
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 53

Expert Comment

by:Joe Winograd, EE MVE
ID: 39848167
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
NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

 
LVL 8

Expert Comment

by:Amit Khilnaney
ID: 39848173
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
ID: 39848178
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
ID: 39848197
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 53

Expert Comment

by:Joe Winograd, EE MVE
ID: 39848207
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
ID: 39848222
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 53

Expert Comment

by:Joe Winograd, EE MVE
ID: 39848666
cpatelx,
Do you want the counts to include subfolders? Regards, Joe
0
 
LVL 53

Expert Comment

by:Joe Winograd, EE MVE
ID: 39848783
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
ID: 39848798
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 53

Accepted Solution

by:
Joe Winograd, EE MVE earned 500 total points
ID: 39848835
>  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
ID: 39850156
Thanks Joe
0
 

Author Comment

by:cpatelx
ID: 39850158
I will do some testing now
0
 
LVL 53

Expert Comment

by:Joe Winograd, EE MVE
ID: 39850265
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
ID: 39850287
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 53

Expert Comment

by:Joe Winograd, EE MVE
ID: 39850325
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
ID: 39850369
Yes! indeed it is including sub folders.. I apologize. I had to reread your post above regarding 'Date='2014,**,**'.
0
 

Author Comment

by:cpatelx
ID: 39850385
Good results! I verified the count for about 10 dates thus far
0
 
LVL 53

Expert Comment

by:Joe Winograd, EE MVE
ID: 39850433
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
 
LVL 53

Expert Comment

by:Joe Winograd, EE MVE
ID: 39850505
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
ID: 39851322
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 53

Expert Comment

by:Joe Winograd, EE MVE
ID: 39851383
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
ID: 39851421
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 53

Expert Comment

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

Author Comment

by:cpatelx
ID: 39851502
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
ID: 39851528
Joe, I am attaching an image as better example of the folder structure
folder structure
0
 
LVL 53

Expert Comment

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

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

Expert Comment

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

Expert Comment

by:Eirman
ID: 39851842
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 53

Expert Comment

by:Joe Winograd, EE MVE
ID: 39851962
> 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
ID: 39852759
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
ID: 39852834
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
ID: 39853373
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
ID: 39853409
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 53

Expert Comment

by:Joe Winograd, EE MVE
ID: 39853568
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
ID: 39853605
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
ID: 39853631
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
ID: 39853659
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 53

Expert Comment

by:Joe Winograd, EE MVE
ID: 39853666
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
ID: 39853850
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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
On some Windows 7 (SP1) computers, Windows Update becomes super slow even the computer is reasonably fast.  There's one solution that seemed to have worked well for me (after trying a few other suggested solutions).
This Micro Tutorial will teach you how to change your appearance and customize your Windows 7 interface to your unique preference. This will be demonstrated using Windows 7 operating system.
Sometimes we receive PDF files that are in the wrong orientation. They may be sideways or even upside down. This most commonly happens with scanned or faxed documents. It is possible to rotate the view of these PDFs with the free Adobe Reader produc…

792 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