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

DonationCoder.com Software > Post New Requests Here

Someone already answered this once but I cannot find the solution :( DIR list

(1/2) > >>

questorfla:
I have to repeatedly create a special file which is nothing more than a recursive directory listing stating with level 1 through level 4 and no further.  There are plenty of files and folders beneath level 4 and everything I try keeps going down too far.  Several months back I asked the question differently and was sent to a program which works but was almost too complicated.
Then out of the blue someone posted a way to do this through Powershell that was about as simple as it gets but for the life of me I cannot find it.  It almost seems like it was similar to the UNIX DU command but it gave directory names instead of size.   It was a one line batch file run under powershell is the best I can remember.  Best of all, the listing gave each folder in a complete path showing all four levels.  If anyone has any ideas of where to find such I would appreciate it.  I'm still looking and if I find it I will answer my own question in case it might help someone else one day

4wd:
Honestly, you need to start checking the Reply Notification box  :D

See here.

You'll want \*\*\*\* as the argument.

skwire:
questorfla, now that you have the link to the original thread, do you mind if I delete this one?

4wd:
I was going to add that I haven't got it outputing to a text file, maybe Shades can help there.

Cracked it:

Get-ChildItem \*\*\*\* | % { if ($_.Attributes -eq "Directory") { Out-File d:\out.txt -append -inputobject $_.FullName } }

The above will output normal folders to 4 levels deep to a file called D:\out.txt <- change as you will.

I'll add this to the other post skwire.

questorfla:
I need to try these above but after a lot of searching and a few adjustments  I finally got the one below to wortk:  Except
It has nothing but visual output.  I swear I am getting too old for this.  This is a simple reciursice batch file but every place i have tried to insert a redirect to a text file for the output fails miserably.  Anyone who sees my blindspot, please insert it where it belongs and I will take my bashing. :( Maybe this is just too easy to see?


@echo off
setlocal
set currentLevel=0
set maxLevel=%2
if not defined maxLevel set maxLevel=2  <<  This is where i need it set to get the list i need with the levels i need.  I can see them fly past and i used to know how to catch them.

:procFolder
pushd %1 2>nul || exit /b
if %currentLevel% lss %maxLevel% (
  for /d %%F in (*) do (
    echo %%~fF                                                            <<This is where I thought I could catch the output but  no go
    set /a currentLevel+=1
    call :procFolder "%%F"
    set /a currentLevel-=1
  )
)
popd

Navigation

[0] Message Index

[#] Next page

Go to full version