Results 1 to 8 of 8

Thread: need directory lister that outputs a file with just main directory, not files

  1. #1
    Senior Member
    Join Date
    Jul 2008
    Posts
    1,130
    Thanks
    6
    Thanked
    98 times in 91 posts

    need directory lister that outputs a file with just main directory, not files

    i don't use directory listers much, but googled and tried a few but couldn't find one that does what i need, so i wondered if anyone knew of any that does this

    basically i have a folder that has say 500 main directories, and maybe 300 sub directories from there, and say a dozen files in each folder/subfolder

    the file listers i found list everything, including folder and list of files in the folders. i think one or two let you exclude the sub folders

    what i'm after is just to output a list of the main folders to a text file, but not the subdirectories and certainly not the files, as the list would be huge. what i want to do is take the text file and import it to excel/libreoffice and make each line/folder a single excel cell, as i have a spreadsheet with a list of stuff and basically want to compare that list with the folders to see what's missing and create a shortlist so i can then find the missing items

    i could potentially use one of the outputs on the programs i used but it would take ages to remove all the unnecessary data. i'm not that great on spreadsheets to do it using a forumula. i thought there may be a program that would give that option. as it's pretty much a one-off i'm hoping to get a free version or a fully working 10 day trial or something like that. or can it be done with command line?

    thanks!

  2. #2
    Supermarket Generic Brand AETAaAS's Avatar
    Join Date
    May 2013
    Location
    Merseyside
    Posts
    654
    Thanks
    79
    Thanked
    147 times in 129 posts
    • AETAaAS's system
      • Motherboard:
      • MSI B450M Gaming Plus
      • CPU:
      • AMD Ryzen 2600
      • Memory:
      • 16GB Vengeance 3000
      • Storage:
      • Intel 660p 1TB
      • Graphics card(s):
      • EVGA 1080TI SC2
      • PSU:
      • Seasonic Focus 850W
      • Case:
      • Fractal Design Focus G
      • Operating System:
      • Windows 10 x64
      • Monitor(s):
      • HP Envy 32
      • Internet:
      • 17mbps

    Re: need directory lister that outputs a file with just main directory, not files

    You can use the DIR command in the command prompt. The stuff in the squared brackets is an example of what to type in. Go to start, search for cmd.exe and run it as administrator.

    Use the CD command to go to the folder you want, eg [CD C:\Users\Unique\Target\]
    Then the DIR command to list all the files when your prompt is in the desired directory. [DIR]
    This can be combined with the output command (>) to output the info to a file. The example command is [DIR >C:\list.txt]
    The above will run the DIR command and print the output into the specified file.

    Then use this Excel procedure to trim the extra information from the front of each field. https://www.extendoffice.com/documen...om-string.html

    There could well be an easier procedure but this is how I've remembered how to do something like this.

  3. Received thanks from:

    Unique (08-03-2017)

  4. #3
    Splash
    Guest

    Re: need directory lister that outputs a file with just main directory, not files

    Tree will do this

    tree [directory] > tree.txt

  5. Received thanks from:

    Unique (08-03-2017)

  6. #4
    Senior Member
    Join Date
    Jul 2009
    Location
    West Sussex
    Posts
    1,721
    Thanks
    197
    Thanked
    243 times in 223 posts
    • kompukare's system
      • Motherboard:
      • Asus P8Z77-V LX
      • CPU:
      • Intel i5-3570K
      • Memory:
      • 4 x 8GB DDR3
      • Storage:
      • Samsung 850 EVo 500GB | Corsair MP510 960GB | 2 x WD 4TB spinners
      • Graphics card(s):
      • Sappihre R7 260X 1GB (sic)
      • PSU:
      • Antec 650 Gold TruePower (Seasonic)
      • Case:
      • Aerocool DS 200 (silenced, 53.6 litres)l)
      • Operating System:
      • Windows 10-64
      • Monitor(s):
      • 2 x ViewSonic 27" 1440p

    Re: need directory lister that outputs a file with just main directory, not files

    Yes, the DIR command is the easiest way since you don't have to download anything.
    As with all Windows commands, it has built-in help using the /? option:
    Code:
    DIR /?
    The options you want are /a (for attribute) and then d. Then you want to not display the date, time, <DIR> so use the /b option
    Code:
    DIR /ad /b
    Combine that with redirecting this to a file as AETAaAS as already said:
    Code:
    DIR/ad/b >%USERPROFILE%\DESKTOP\Output.txt
    The %USERPROFILE%\DESKTOP bit should place your output to on your desktop (provided you haven't moved the location of the desktop) using the environmental variable %USERPROFILE%.
    RANT: for some reason Microsoft never created an environmental variable for the Desktop despite it being a very important location for users; logically that should have been done back when Windows95 came out.

    Alternatively you could install something like Agent Ransack:
    https://mythicsoft.com/agentransack
    and use that to search in your folder (turn off subfolders) and go to the report pane, select Tabulated - CSV and save it and open it Excel etc. As it put everything in columns in the spreadsheet you can easily delete the headers and surplus stuff, then use Excel to sort by the column containing the Type and delete any rows which aren't of type File Folder

  7. Received thanks from:

    Unique (08-03-2017)

  8. #5
    Senior Member
    Join Date
    Jul 2008
    Posts
    1,130
    Thanks
    6
    Thanked
    98 times in 91 posts

    Re: need directory lister that outputs a file with just main directory, not files

    thanks for the suggestions. i'll try when I get home. in excel I'm used to the text to columns function that let's me cut off bits I don't need, but all the main folders start with a date then info and ultimately I'm going to match by date with the main spreadsheet and the end result is to find the ones that don't match, which should hopefully be a short list, and I can work with that. so having the date and stuff like that after the folder name isn't a problem, it was mainly the programs I tried listed the folder name then all the subdirs and files underneath

    still open to suggestions if anyone else has any. a GUI program is preferred, but I turn to command line when necessary. fortunately I learned pc's back in the DOS days before windows, but forgot most commands due to not needing to use them in windows

  9. #6
    Senior Member
    Join Date
    Jul 2008
    Posts
    1,130
    Thanks
    6
    Thanked
    98 times in 91 posts

    Re: need directory lister that outputs a file with just main directory, not files

    Quote Originally Posted by kompukare View Post
    Yes, the DIR command is the easiest way since you don't have to download anything.
    As with all Windows commands, it has built-in help using the /? option:
    Code:
    DIR /?
    The options you want are /a (for attribute) and then d. Then you want to not display the date, time, <DIR> so use the /b option
    Code:
    DIR /ad /b
    Combine that with redirecting this to a file as AETAaAS as already said:
    Code:
    DIR/ad/b >%USERPROFILE%\DESKTOP\Output.txt
    The %USERPROFILE%\DESKTOP bit should place your output to on your desktop (provided you haven't moved the location of the desktop) using the environmental variable %USERPROFILE%.
    RANT: for some reason Microsoft never created an environmental variable for the Desktop despite it being a very important location for users; logically that should have been done back when Windows95 came out.

    Alternatively you could install something like Agent Ransack:
    https://mythicsoft.com/agentransack
    and use that to search in your folder (turn off subfolders) and go to the report pane, select Tabulated - CSV and save it and open it Excel etc. As it put everything in columns in the spreadsheet you can easily delete the headers and surplus stuff, then use Excel to sort by the column containing the Type and delete any rows which aren't of type File Folder
    just to say thanks and agent ransack did the job. i'd never heard of that before. simple to install and run and it created the csv file, imported to libreoffice and it appears i have just what i was after

  10. #7
    Senior Member
    Join Date
    Jul 2009
    Location
    West Sussex
    Posts
    1,721
    Thanks
    197
    Thanked
    243 times in 223 posts
    • kompukare's system
      • Motherboard:
      • Asus P8Z77-V LX
      • CPU:
      • Intel i5-3570K
      • Memory:
      • 4 x 8GB DDR3
      • Storage:
      • Samsung 850 EVo 500GB | Corsair MP510 960GB | 2 x WD 4TB spinners
      • Graphics card(s):
      • Sappihre R7 260X 1GB (sic)
      • PSU:
      • Antec 650 Gold TruePower (Seasonic)
      • Case:
      • Aerocool DS 200 (silenced, 53.6 litres)l)
      • Operating System:
      • Windows 10-64
      • Monitor(s):
      • 2 x ViewSonic 27" 1440p

    Re: need directory lister that outputs a file with just main directory, not files

    Quote Originally Posted by Unique View Post
    just to say thanks and agent ransack did the job. i'd never heard of that before. simple to install and run and it created the csv file, imported to libreoffice and it appears i have just what i was after
    Neat little program. Has regular expressions too (with a little tester) and they have a different named version of their free version called FileLocator Lite since installing an Agent Ransack might not sound too good on a work machine.

  11. #8
    Registered User
    Join Date
    Sep 2016
    Posts
    48
    Thanks
    0
    Thanked
    2 times in 2 posts

    Re: need directory lister that outputs a file with just main directory, not files

    I like TREE command too (per Splash above) - http://www.computerhope.com/treehlp.htm

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •