Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Quick DOS Question

  • 28-02-2007 2:12pm
    #1
    Registered Users, Registered Users 2 Posts: 7,754 ✭✭✭


    I'm trying to print a list of folders and subfolders from one of my drives into a textfile.

    At the moment I'm using:

    dir /s /on *.* > Tree.txt

    The one problem with this is it's also printing the files contained in each directory. Is there any way to print the folder names only?

    Thanks.


Comments

  • Closed Accounts Posts: 1,974 ✭✭✭mick.fr


    dir /s /ad


  • Registered Users, Registered Users 2 Posts: 1,399 ✭✭✭WetDaddy


    Man, it's been a while since I worked with DOS, but you could try removing the second asterisk in your 'file' listing parameter. So, something like this:

    dir /s /on *. > Tree.txt


    That has the potential to also give you files without extensions, mind you. But these aren't too common on Windows / DOS systems, with the exception of things like the hosts file.

    If you're happy enough manually removing a few, go with that. Otherwise, if you want a GUARANTEED directory-only listing, there's probably a switch with dir you can use. Either that, or maybe specifiy a filesize of 0 or something?


  • Registered Users, Registered Users 2 Posts: 1,399 ✭✭✭WetDaddy


    mick.fr wrote:
    dir /s /ad

    Yep, that'll do it better than my way ;) That'll teach me to try and be the first to answer a techy post!

    But hey, maybe you learned something from me. Like to call them directories, and not folders, and to keep doing it as get older and appear wizened & cantankerous.

    Oh, by the way, you might want to put in: /adh (notice the extra 'h') to show you any hidden directories too, if desired.


  • Registered Users, Registered Users 2 Posts: 21,499 ✭✭✭✭Alun


    deathfunk wrote:
    Oh, by the way, you might want to put in: /adh (notice the extra 'h') to show you any hidden directories too, if desired.
    Actually dir /adh will show you only the hidden directories, dir /ad will show all of them (including the hidden ones). All it's doing is showing those directory entries that match all of the given attributes on the /a switch.


  • Registered Users, Registered Users 2 Posts: 7,754 ✭✭✭ianmc38


    Thanks for the info. Micks suggestion worked perfectly for me!


  • Advertisement
Advertisement