thomas-hiron
thomas-hiron

Reputation: 948

Save a directory list to a text file

I'm trying to list the content of two directories on my HD and put it in a file.

For the moment I have this which list all the directories and contents :

echo off
for /r %%a in (*) do echo %%a >> file.txt

How can I look into a specific folder like Pictures for example ?

Here is the tree :

> Dir1
> Dir2
> Pictures
> file.bat

Upvotes: 0

Views: 910

Answers (2)

foxidrive
foxidrive

Reputation: 41234

dir /b /s /a-d "c:\pictures" >file.txt

Upvotes: 0

Endoro
Endoro

Reputation: 37569

try this:

for /r "pictures" %%a in (*) do echo %%~nxa

Upvotes: 3

Related Questions