Solved Copy Filename & File Size (ONLY)

April 10, 2013 at 11:30:33
Specs: Windows Vista
I am trying to use .bat file to grab both the file names and their sizes ONLY.
Right now I have a name grabber that will pull just the filenames with extensions. So now I need to figure out how to add the file size to the script. Or a totally new script that will do both is fine.

Some of the folders I am working in has over 100 files so trying to type the file sizes into an excel sheet (like I have to do) takes awhile.

This is the only information needed. Can anyone help me with this?

Using Excel 2007 and Vista.


I am currently using this:

dir /a/b/od /-p /o:gen >FileNames.txt
FileNames.txt
del FileNames.txt

Thanks in adavance,


See More: Copy Filename & File Size (ONLY)

Report •


✔ Best Answer
April 16, 2013 at 00:01:49
:: ===== script starts here ===============
::
:: SIZENAME.bat 2013-04-11 2:36:05.03
@echo off > NEWFILE & setLocal enableDELAYedeXpansioN
for /f "tokens=* delims= " %%a in ('dir/b/a-d') do (
echo.%%~Za %%~Na
)>> NEWFILE
::====== script ends here =================

=====================
M2 Golden-Triangle



#1
April 10, 2013 at 12:37:54
:: ===== script starts here ===============
::
:: SIZENAME.bat 2013-04-11 2:36:05.03
@echo off > NEWFILE & setLocal enableDELAYedeXpansioN

for /f "tokens=* delims= " %%a in ('dir/b/a-d') do (
echo.%%~Za %%~Na
)
goto :eof
::====== script ends here =================

=====================
M2 Golden-Triangle


Report •

#2
April 10, 2013 at 12:44:06
Mechanix2Go,

Thank you for helping. It is producing a file called "New File" that is 0KB

Does it matter if the files are zipped? I deal with files that are to stay zipped and I need thier sizes and names in that state & also raw files where I need the same.

Thanks,


Report •

#3
April 10, 2013 at 13:01:05
The empty NEWFILE is just me being lazy.

You want to check inside zips?

=====================
M2 Golden-Triangle


Report •

Related Solutions

#4
April 10, 2013 at 13:04:26
No... I have two scenarios in which I must get filenames and sizes... (Hopefully I'll explain this right, bare wtih me).

(1) I need some files in their zipped state and I need their file name and size to log onto the excel sheet.

(2) I will manually unzip the files to their raw state (eg: .txt) and I then need those filenames and sizes to log.

I hope this explained what I'm trying to do.


Report •

#5
April 15, 2013 at 07:15:28
Still just getting a file called "NEWFILE" that is 0 KB in size .... any further suggestions???

:: ===== script starts here ===============
::
:: SIZENAME.bat 2013-04-11 2:36:05.03
@echo off > NEWFILE & setLocal enableDELAYedeXpansioN
for /f "tokens=* delims= " %%a in ('dir/b/a-d') do (
echo.%%~Za %%~Na
)
goto :eof
::====== script ends here =================


Report •

#6
April 16, 2013 at 00:01:49
✔ Best Answer
:: ===== script starts here ===============
::
:: SIZENAME.bat 2013-04-11 2:36:05.03
@echo off > NEWFILE & setLocal enableDELAYedeXpansioN
for /f "tokens=* delims= " %%a in ('dir/b/a-d') do (
echo.%%~Za %%~Na
)>> NEWFILE
::====== script ends here =================

=====================
M2 Golden-Triangle


Report •

#7
April 16, 2013 at 05:01:50
Mechanix2Go - You are a lifesaver!!!!!!!!!! Thank you soooooooo much!!!!

Report •


Ask Question