Dir commandthat displays each file with complete path, with file sizes

I'm looking for a dir command that displays each file with complete path, with file sizes. "dir /s /b" doesn't show sizes.
8 answers Last reply
More about commandthat displays file complete path file sizes
  1. The /b (bare) tells it not to show file sizes. Don't use the /b switch. there is no switch to have it show the full path. You will need to find a utility other than "dir".
  2. Hawkeye22 said:
    The /b (bare) tells it not to show file sizes. Don't use the /b switch. there is no switch to have it show the full path. You will need to find a utility other than "dir".


    Hi Hawkeye,
    Strangely enough, the /s /b combination does give full paths; it just doesn't give file sizes. Thanks for replying. Chas
  3. That's weird. The help says /b is bare and when I do a dir /s/b on my xp computer all I get is the full path/filename. I'm not sure if ls comes standard on xp. Try this:

    ls -R -s

    That's a capital R and lower case s.
  4. Hawkeye22 said:
    That's weird. The help says /b is bare and when I do a dir /s/b on my xp computer all I get is the full path/filename. I'm not sure if ls comes standard on xp. Try this:

    ls -R -s

    That's a capital R and lower case s.



    Thanks - I'll try this as soon as I figure out how to make Unix commands work.
  5. Yeah, it works on my xp machine, but I can't remember if it came with the system or if I installed some developer tool that added this in.
  6. charles gentry said:
    I'm looking for a dir command that displays each file with complete path, with file sizes. "dir /s /b" doesn't show sizes.



    @REM =======================
    @REM newdir.cmd
    @echo off
    SETLOCAL ENABLEDELAYEDEXPANSION

    FOR /R . %F in (*) DO (
    set y=0000000000%%~zF
    echo %%~tF !y:~-10! %%~fF )
    @echo on
    @REM =======================

    run command: newdir
    or to sort by size
    run command: newdir | sort /+21

    obviously can add arguments to make it better

    set arg1=%1 @rem expecting . or directory eg c:\tmp\
    set arg2=%2 @rem expecting wildcard * or *.tmp or *.bak

    FOR /R %arg1% %%F in (%arg2%) DO ( ....

    ~?F e.g. ~zF values examples are:
    ~a attributes,
    ~d drive ,
    ~f full filename,
    ~n name of file without ext,
    ~p = folder(s),
    ~s= short filename,
    ~t = datetime stamp,
    ~x=ext,
    ~z = size in bytes

    Cheers
    LAMS
  7. Thanks LAMS. I will try it. Charles
  8. charles gentry said:
    Thanks LAMS. I will try it. Charles


    oops stuff up it should be %%F instead of %F in the text file that is saved as
    newdir.cmd

    @REM =======================
    @REM newdir.cmd
    @echo off
    SETLOCAL ENABLEDELAYEDEXPANSION

    FOR /R . %%F in (*) DO (
    set y=0000000000%%~zF
    echo %%~tF !y:~-10! %%~fF )
    @echo on
    @REM =======================

    run command: newdir
    or to sort by size
    run command: newdir | sort /+21
Ask a new question

Read More

Configuration Displays Command Prompt Windows XP