Solved

Working for /f script, but need filesizes

Posted on 2011-02-15
5
287 Views
Last Modified: 2012-05-11
I received help before building a script that works great, but I'd like to amend the script to show file sizes of all of the *.mp3 that it finds.  

Here is the script(from billprew):

@echo off
REM Process each line (server name) from server text file
for /F %%A in (Servers3.txt) do (
  REM Find all MP3 files on this server and report it
  for /F "tokens=*" %%B in ('dir /s /a-d /b \\%%A\Data\*.mp3') do (
    echo %%A,%%B>>C:\Scripts\MP3.csv
  )
)

How would we get it to list file sizes of the MP3's it finds into the csv?

thanks!
0
Comment
Question by:LarrySingleton
  • 2
  • 2
5 Comments
 
LVL 16

Expert Comment

by:sjklein42
ID: 34900560
This token will show the size

%%~zB

Open in new window

0
 
LVL 16

Accepted Solution

by:
sjklein42 earned 25 total points
ID: 34900580
Paste into a command window to test:

@for %i in (*) do @echo %i has size %~zi

Open in new window

0
 
LVL 5

Assisted Solution

by:jason987
jason987 earned 75 total points
ID: 34901092
This is what sjklein42 is telling you:

@echo off
REM Process each line (server name) from server text file
for /F %%A in (Servers3.txt) do (
  REM Find all MP3 files on this server and report it
  for /F "tokens=*" %%B in ('dir /s /a-d /b \\%%A\Data\*.mp3') do (
    echo %%A,%%B,%%~zB>>C:\Scripts\MP3.csv
  )
)

Open in new window

0
 

Author Comment

by:LarrySingleton
ID: 34910780
Ok thanks for the response(s).  I am testing now.
0
 

Author Closing Comment

by:LarrySingleton
ID: 34918133
Awarding 25 pts to sjklein42 for partial answer and 75 to jason987 for elaboration/completion.

Thanks to both!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to get the next number in a sequence via a DOS batch job 10 48
DOS expert? 3 49
Help with a batch file 13 81
Windows Batch File - Count Down 4 62
One of my most closely kept secrets is revealed in this discussion How to output text on the same line This question was recently posted in EE by Simon336697 (http://www.experts-exchange.com/Programming/Languages/Scripting/Shell/Batch/Q_2459…
TOMORROW TOMORROW.BAT is inspired by a question I get asked over and over again; that is, "How can I use batch file commands to obtain tomorrow's date?" The crux of this batch file revolves around the XCOPY command - a technique I discovered w…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now