Listing MP3 file names and file duration.

  • Thread starter Thread starter windsurferLA
  • Start date Start date
W

windsurferLA

Listing MP3 file names and file duration.

A while back I got help writing the following BAT file to write the
names of the files in the selected directory to a text file and to open
that file. The data is written to the file FileList.txt.

@echo off
dir %1 /-p /s /o:g-d > "C:\Documents and Settings\Michael\My
Documents\__Scratch\_images\ListsFiles.txt"
start /w notepad C:\Documents and Settings\Michael\My
Documents\__Scratch\_images\ListsFiles.txt
del C:\Documents and Settings\Michael\My
Documents\__Scratch\_images\ListsFiles.txt
exit

When executed, each file is listed on a separate line, along with its
date and size.

QUESTION 1

Is there some way to have it list the duration mp3 files, if there are
mp3 files in the selected directory?


ALTERNATIVELY – RusselB and Schaffer31 posted this code to compute the
total time of all mp3 files in a directory.

menu * { .mp3 Directory : set %dir $sdir(*) .Total Time : echo -a
$total.time(%dir)}
alias total.time {
var %total
var %a = 1, %b = $findfile($+(",$1-,"),*.mp3,0)
while (%a <= %b) {
var %file = $findfile($+(",$1-,"),*.mp3,%a)
%total = $calc(%total + $calc($mp3(%file).length / 1000))
echo -a %file $sound(%file).length
$duration($calc($sound(%file).length / 1000)) %total $duration(%total)
inc %a
}
return $duration(%total)
}

QUESTION 2

I’ve never written any VBS script files. I would assume that one would
place the code in a file using Notepad and assign the .vbs suffix to it.
How do you get it to run while you are designating the directory
containing the mp3 files to be totaled.
 
Retrieving Extended properties:
http://www.microsoft.com/technet/scriptcenter/guide/sas_fil_lunl.mspx?mfr=true
http://groups.google.co.in/group/microsoft.public.windowsxp.general/msg/5712a1a177c01f80

--
Regards,

Ramesh Srinivasan, Microsoft MVP [Windows XP Shell/User]
Windows® XP Troubleshooting http://www.winhelponline.com


Listing MP3 file names and file duration.

A while back I got help writing the following BAT file to write the
names of the files in the selected directory to a text file and to open
that file. The data is written to the file FileList.txt.

@echo off
dir %1 /-p /s /o:g-d > "C:\Documents and Settings\Michael\My
Documents\__Scratch\_images\ListsFiles.txt"
start /w notepad C:\Documents and Settings\Michael\My
Documents\__Scratch\_images\ListsFiles.txt
del C:\Documents and Settings\Michael\My
Documents\__Scratch\_images\ListsFiles.txt
exit

When executed, each file is listed on a separate line, along with its
date and size.

QUESTION 1

Is there some way to have it list the duration mp3 files, if there are
mp3 files in the selected directory?


ALTERNATIVELY – RusselB and Schaffer31 posted this code to compute the
total time of all mp3 files in a directory.

menu * { .mp3 Directory : set %dir $sdir(*) .Total Time : echo -a
$total.time(%dir)}
alias total.time {
var %total
var %a = 1, %b = $findfile($+(",$1-,"),*.mp3,0)
while (%a <= %b) {
var %file = $findfile($+(",$1-,"),*.mp3,%a)
%total = $calc(%total + $calc($mp3(%file).length / 1000))
echo -a %file $sound(%file).length
$duration($calc($sound(%file).length / 1000)) %total $duration(%total)
inc %a
}
return $duration(%total)
}

QUESTION 2

I’ve never written any VBS script files. I would assume that one would
place the code in a file using Notepad and assign the .vbs suffix to it.
How do you get it to run while you are designating the directory
containing the mp3 files to be totaled.
 
Back
Top