Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Generic User Avatar

Batch File To List Folder Names "mywork"


  • Please log in to reply
1 reply to this topic

#1 aspfun

aspfun

  •  Avatar image
  • Members
  • 269 posts
  • OFFLINE
  •  
  • Local time:04:51 PM

Posted 06 March 2022 - 02:30 PM

I saved a lot of files in "mywork" folder which stored in many folders and subfolders.

How to create a batch file to list all folders in which including "mywork" folder?

From searching, below batch only list all folders.

 

@echo off

for /d %%D in (*) do echo %%~nxD

 



BC AdBot (Login to Remove)

 


#2 JohnC_21

JohnC_21

  •  Avatar image
  • Members
  • 36,161 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:04:51 PM

Posted 07 March 2022 - 09:34 AM

I can't help with the batch file but you can do the same thing with Powershell.

 

Run Powershell as Admin then input the below at the prompt. Press enter. This will create a text file called output on the root of C:

Get-ChildItem -Path <path> -Recurse -Directory | Out-File -FilePath C:\Output.txt

  Substitute the path to your main folder for <path>. 






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users