Hi Folks -
Does anyone have a batch script can be run over a specific directory that prints the following:
1. File path (including drive)
2. File name (including extension)
3. TOTAL length
ONLY if the total length is OVER 218 characters?
Thanks!
Batch Script to print file path, file name (including extension) and FULL length in character?
Moderator: DosItHelp
Re: Batch Script to print file path, file name (including extension) and FULL length in character?
SIMMS7400 wrote:Hi Folks -
Does anyone have a batch script can be run over a specific directory that prints the following:
1. File path (including drive)
2. File name (including extension)
3. TOTAL length
ONLY if the total length is OVER 218 characters?
Thanks!
Hi
So the condition is only if the total length is OVER 218 characters, we echo :
1 - The File Path
2 - The File Name
EDIT
Try this script :
Code: Select all
@echo off
set "Log=Test.txt"
If exist %Log% Del %Log%
setlocal enabledelayedexpansion
for /F "tokens=1 delims=" %%i in ('dir /o:-n /b /s') do (
set FilePath=%%i
set FileName=%%~nxi
set part=!FilePath:~0,218!
if !FilePath! GTR !part! (
(
echo !FileName!
echo !FilePath!
echo =========================
)>>%Log%
)
)
start "" %Log%
Re: Batch Script to print file path, file name (including extension) and FULL length in character?
Thank you, Hack! Works like a charm!!