?
Solved

Working for /f script, but need filesizes

Posted on 2011-02-15
5
Medium Priority
?
292 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 100 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 300 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

The following is a collection of cases for strange behaviour when using advanced techniques in DOS batch files. You should have some basic experience in batch "programming", as I'm assuming some knowledge and not further explain the basics. For some…
Being a system administrator some time we require to do things remotely, one of them is installing software. Here I am going to tell you how to install software through wmic (Windows management instrument console). I am not at all saying that this i…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

770 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