Create a directory file list

July 6, 2011 at 01:12:23
Specs: XP
I'm doing some cleaning on my office shared directory and i would like to create a directory list that shows file name and size , hopefully one line for each file. Maybe a batch file that sends the information to a CSV file. would like the file to look something like this:
/myfolder/subfolder/myfile.txt - 564k
/myfolder/subfolder/Newfile.doc - 56k

See More: Create a directory file list

Report •

July 6, 2011 at 07:02:50
@echo off & setlocal EnableDelayedExpansion
type nul > "FileList.txt"
for /F "delims=" %%A in ('dir /S /B /A-D "Your_Directory"') do (
  set file=%%~pnxA
  set size=%%~zA
   set /A size/=1024
  echo.!file! - !size!K >> "FileList.txt"

To generate a .csv file is possible but requires the *exact* layout wished.

Report •

July 9, 2011 at 00:10:04
Thanks, tried this in a batch file, filelist.txt created,however nothing listed in file.

Report •
Related Solutions

Ask Question