Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 295
  • Last Modified:

Working for /f script, but need filesizes

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
LarrySingleton
Asked:
LarrySingleton
  • 2
  • 2
2 Solutions
 
sjklein42Commented:
This token will show the size

%%~zB

Open in new window

0
 
sjklein42Commented:
Paste into a command window to test:

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

Open in new window

0
 
jason987Commented:
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
 
LarrySingletonAuthor Commented:
Ok thanks for the response(s).  I am testing now.
0
 
LarrySingletonAuthor Commented:
Awarding 25 pts to sjklein42 for partial answer and 75 to jason987 for elaboration/completion.

Thanks to both!
0

Featured Post

Restore individual SQL databases with ease

Veeam Explorer for Microsoft SQL Server delivers an easy-to-use, wizard-driven interface for restoring your databases from a backup. No expert SQL background required. Web interface provides a complete view of all available SQL databases to simplify the recovery of lost database

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now