topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Thursday March 28, 2024, 12:03 pm
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: Someone already answered this once but I cannot find the solution :( DIR list  (Read 6012 times)

questorfla

  • Supporting Member
  • Joined in 2012
  • **
  • Posts: 570
  • Fighting Slime all the Time
    • View Profile
    • Donate to Member
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

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,641
    • View Profile
    • Donate to Member
Honestly, you need to start checking the Reply Notification box  :D

See here.

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

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,286
    • View Profile
    • Donate to Member
questorfla, now that you have the link to the original thread, do you mind if I delete this one?

4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,641
    • View Profile
    • Donate to Member
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.
« Last Edit: October 01, 2013, 06:51 PM by 4wd »

questorfla

  • Supporting Member
  • Joined in 2012
  • **
  • Posts: 570
  • Fighting Slime all the Time
    • View Profile
    • Donate to Member
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

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,286
    • View Profile
    • Donate to Member
@questorfla: Would you mind moving your previous post to the original thread to avoid fragmenting your thread any further?  I can then delete this thread...

questorfla

  • Supporting Member
  • Joined in 2012
  • **
  • Posts: 570
  • Fighting Slime all the Time
    • View Profile
    • Donate to Member
sorry people>  I am not in the best of shape tonight.  Supposed to have some heavy duty dental surgery .. but not yet apparently..They keep saying maybe tomorrow
so.. Just.trying to stay focused.  I appreciate everyones efforts  if you could leave me the one link skwire I would appreciate it.  the old question ended up with some real doozies i remember they were rather intricate.
4WD's setup (I have not tried it yet) but it is simple enough i can understand the logic so i can adjust as needed.
Thanks to you all

The long and twisted batch that i listed above also did work but with no saved output it wasn't much help.

Before I leave, does anyone know if I can install the NEW release of WAMP or XAMPP and leave off the MySQL5 and replace it with 4.3 i think that was as high as MYIsam support went?  i have to keep MYIsam tables if at all possible.  We have hundreds of archived databases that all used MYIsam. They would be unreadable without it if needed again otherwise. 

questorfla

  • Supporting Member
  • Joined in 2012
  • **
  • Posts: 570
  • Fighting Slime all the Time
    • View Profile
    • Donate to Member
Skwire :  maybe this is how i say Yes?  I cannot find a single place to click to reply to your questions showt of a whole new one  .  Yes PLEASE shorten it

4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,641
    • View Profile
    • Donate to Member
    echo %%~fF                                                            <<This is where I thought I could catch the output but  no go

You forgot the redirection:

echo %%~fF >>D:\somefile.txt

 ;)

questorfla

  • Supporting Member
  • Joined in 2012
  • **
  • Posts: 570
  • Fighting Slime all the Time
    • View Profile
    • Donate to Member
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.

I finally tried this under Powershell with this error:

Get-ChildItem : Access to the path 'C:\Windows\CSC\v2.0.6' is denied. ??

I am aadmin as you can get on this system