top of page

Today at work I used a batch file with the XCOPY command to copy a large number of files into a few hundred different subdirectories. I wanted to confirm that each subfolder had a certain number of files copied into it, but I didn't want to take the trouble of parsing through the results of a standard dir command (such as "dir /b /s /a-d >list.txt") which would generate a complete list of file paths for all files in a directory.

I was able to devise a command which gave me the path of each subdirectory followed by the number of files in it. See this command:

dir /a /s | findstr "Directory File(s)"

Adding a pipe | after the dir command followed by the findstr command filters the results for the strings listed in the parentheses. We get just the parts of the results we want to focus on.


 
 

Adding a simple option can allow you to modify the results returned with dir, findstr, and other Windows commands. /v will exclude lines including what is designated in parentheses after it. So for example, this command:

dir /s /b | findstr /i "Milwaukee"

. . . will search for all files and folders which include the search term, "Milwaukee". Modifying the command with the /v option can exclude results from directories which include the string, "beer"

dir /s /b | findstr /i "Milwaukee" | findstr /v "beer"


 
 
  • Jan 8, 2019

You can use the tskill command to close all instances of a program such as Excel. Simply press the Windows Key and R to open Run. Then enter the command followed by the name of the program you want to shut down.

tskill explorer will close Windows Explorer

tskill chrome will close the Google Chrome browser

tskill excel will close Microsoft Excel

In Task Manager refer to process image name in order determine the name of the software you want to close.


 
 

Sean O'Shea has more than 20 years of experience in the litigation support field with major law firms in New York and San Francisco.   He is an ACEDS Certified eDiscovery Specialist and a Relativity Certified Administrator.

The views expressed in this blog are those of the owner and do not reflect the views or opinions of the owner’s employer.

If you have a question or comment about this blog, please make a submission using the form to the right. 

Your details were sent successfully!

© 2015 by Sean O'Shea . Proudly created with Wix.com

bottom of page