![]() |
|
[Shell] Counting Classes of Files in Subfolder Hierarchy - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118) +---- Thread: [Shell] Counting Classes of Files in Subfolder Hierarchy (/showthread.php?tid=5565267) |
Counting Classes of Files in Subfolder Hierarchy - lneidorf - Mar 3, 2017 Hi there. I have a recurring task that is quite simple, but requires a lot of manual steps. I'm hoping to automate it. On a network drive (which I do map), I have a file structure that looks like this: PARENT FOLDER\ --TEXT\ --IMAGES\ --NATIVES\ I've been trying to write a script that does the following: 1. Generate a count of the files in each subfolder. I need seepage counts for each of the subfolders I've listed above. 2. Generate a list of filenames for the 0KB .txt files in the TEXT subfolder 3. Output to two text file reports, one with counts and the other a list of the 0kb text files by name only. Each of the subfolders I listed above contains a series of subfolders (e.g. TEXT\01\ etc). So I need this script to be recursive and not include any of the subfolders in the counts or list of 0kb files. Seems so simple, yet I can't seem to crack this. Thanks! * - b00st3d - Mar 4, 2017 Check if this does the trick. You'll need to set the actual address for you network drive. NOTE: the network drive address should not have a trailing \ and keep the be sure the "" stay in place. I tested this with the local admin share ( \\computername\c$\ ) so your results may vary using an actual network location. Code @echo off&setlocal enabledelayedexpansion |