ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

DonationCoder.com Software > Finished Programs

DONE: Tally folder contents by file date

<< < (2/4) > >>

4wd:
From here: Powershell version

TallyCreateDate.ps1

--- Code: PowerShell ---Get-ChildItem $args -File | Group {$_.CreationTime.ToString("yyyy-MM-dd")} | Sort Name | Format-Table Name,Count -auto
eg.

.\TallyCreateDate.ps1 "Z:\test folder" >"test folder.txt"

Output:


--- Code: Text ---Name       Count----       -----2015-02-02     12015-06-09     12015-06-28     12015-07-21     12015-08-29     12015-10-24     12015-12-16     12016-01-15     12016-05-27     12016-06-20     12016-07-10     42016-07-12     22017-11-01     12018-04-05     12018-04-14     42018-07-14     22018-08-03     12018-08-08     12018-08-10     12018-08-13     42018-08-14     12018-08-17     32018-09-19     12018-09-24     1

IainB:
From here: Powershell version ...
-4wd (September 24, 2018, 06:50 AM)
--- End quote ---
Ohh...nice find.   :Thmbsup:

4wd:
From here: Powershell version ...
-4wd (September 24, 2018, 06:50 AM)
--- End quote ---
Ohh...nice find.   :Thmbsup:
-IainB (September 24, 2018, 07:14 AM)
--- End quote ---

The power of Google ;)

This'll do every sub-folder of the given folder with matching output names:

--- Code: PowerShell ---$folders = Get-ChildItem $args -Directoryfor ($i = 0; $i -lt $folders.Count; $i++) {  $file = $folders[$i].BaseName + ".txt"  Get-ChildItem $folders[$i].Fullname -File |    Group {$_.CreationTime.ToString("yyyy-MM-dd")} |    Sort Name |    Format-Table Name,Count -Auto |    Out-File -FilePath $file}

nkormanik:
wraith808, beautifully done.  Thanks a million.

TallyFiles -d "C:\Windows System Tools" -o "Windows System Tools.txt"

Two enhancement requests:

1.  Allow the default output file save location be to where TallyFiles.exe resides and is executed from (via batch file there) (instead of folder being acted upon, presently the default save location).

Thus, command would be merely:

TallyFiles -d "C:\Windows System Tools"

(and .txt extension would be added to "Windows System Tools")

2.  I specified "Creation Date."  Could we have the option of "Date Modified"?

You might already be allowing for this through your -c, --compare option.  But I don't understand how it works, if so.

Great job!

Thanks again.

Nicholas

highend01:
My 2 cents...


--- ---TallyFiles.exe "path_1" "path_2" "path_X" [/fmt="yyyy-mm-dd" /date="c"]

- No dependencies
- It allows multiple paths in one call. If they contain spaces, double quotes are a necessity!
- Environment variables in paths are supported, e.g. "%windir%\Fonts"
- /fmt and /date are both optional (and can be used independently from each other)
- It should be clear that the same /fmt and /date values are used for all paths^^
- /fmt allows these elements:
  yyyy - 4 digit year
  yy   - 2 digit year
  mm   - 2 digit month
  dd   - 2 digit day
  hh   - 2 digit hour
  ii   - 2 digit minute
  ss   - 2 digit second
  The default is "yyyy-mm-dd"
- /date can be "c", "m" or "a" where "c" is the default

E.g.:
TallyFiles.exe "%windir%\Fonts"
will write a file named "Fonts.txt" into TallFiles.exe's location (in ascii format) with the creation date (sort method: ascending)

TallyFiles.exe "%windir%\Fonts" /date="m"
The same as above, this time with modified dates

etc.

The attachment contains a x86 and a x64 version...

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version