|
|
Question : Need command line full path directory listing
|
|
Hi guys:
I need to generate a directory listing including each file's name as well as it's full path and it's size and date information. I need it to be able to run froma command line in a batch file. I need to provide it a top level directory and have it recurse everything below that point.
i.e.:
Mydir d:\temp (d:\temp contains 2 files, and 2 subdirectories)
output:
\file1.txt \file2.txt \dir1\file3.txt \dir1\file4.txt \dir2\file4.txt
Anyone know a way or program to do this?
THanks, Scott
|
Answer : Need command line full path directory listing
|
|
"Can it be done??"
Nothing is impossible my friend...it just may be cost-prohibitive! :^)
It certainly makes this difficult that you want to approach it with a dynamic path. Granted, this only strips off the folder parameter that was passed. But I'm afraid if this solution doesn't work for you, it may mean you have to go to a higher-level scripting (either that or I just don't know batch scripting like I thought I did!).
@echo off setlocal enabledelayedexpansion Set RptFile=c:\temprpt.txt echo. > %RptFile%
for /r %1 %%a in (*.*) do ( set iSize=%%~za set sDate=%%~ta for /f "tokens=2* delims=\" %%x in ("%%a") do set sFile=\%%y echo !sFile! !iSize! !sDate! >>%RptFile% )
|
|
|
|