Page 1 of 1

Displaying Seven Character Long Text Files

Posted: 07 May 2009 03:17
by NZIdiot
Hi

I have to write a batch command to display 7 character long text files on the whole C: Drive with the listing output in wide format.

How do i display 7 character long files?

I have used

DIR C:\ /S /W ???????.TXT

but this doesn't work. What do i use?

Thanks in advance.

Posted: 07 May 2009 08:50
by RElliott63
Something to try ... this implies that you don't care what the extension of the file is.

Code: Select all

@echo off
SETLOCAL ENABLEEXTENSIONS
SETLOCAL ENABLEDELAYEDEXPANSION

CD \
For /F "Delims=" %%F In ('Dir /B/S') Do (
    Set "f=%%~nxF"
    Set "p=%%~pF"
    Set "Dot=!f:~7,1!"
    If /I [!Dot!] equ [.] (
       Echo File is 7 bytes:  !f!
       Echo File is located:  !p!
    )
)