Yes, I'm running Windows 2000.
Yes, a command line utility to do that would be the best solution.
Thanks for your reply... hoping the good experts come by soon!! :)
Main Topics
Browse All TopicsHi,
I have 2 main questions...
1. How to get the size of a file into a variable? in MB preferably.
2. How to get the length (time - minutes:seconds) of a mp3 file into a variable?
I also have an outstanding question open in programming (maybe I should have posted it here) that I have further things that I would like done as much as possible within a batch file or if necessary, command line application that runs from the batch file.
That question is: http://www.experts-exchang
An urgent response would be appreciated & with more points!
Many Thanks :)
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
With Windows NT4/W2k/XP, you usually use the "for /f" command to get some output into an environment variable.
In your case, there are several possibilities. If you pass the name of the file you want the size of as an argument, simply use "%~z1" to obtain the size in bytes. You can use "dir" combined with the for /f, but you need to search the output for the filename because of the junk displayed around the actual filename.
As for the size in MB, the NT shell offers rudimentary calculation as well ("set /a").
Here are examples for both:
====8<----[FileSize.cmd]--
@echo off
setlocal
echo Using %%~z1 to obtain the file size:
set Size=%~z1
set /a SizeKB=%Size% / 1024
set /a SizeMB=%SizeKB% / 1024
echo Size in bytes: %Size%
echo Size in KB: %SizeKB%
echo Size in MB: %SizeMB%
echo Enter "help call" for more options.
echo.
echo Using "for /f" to obtain the file size:
:: *** list the filename, pipe it through "find" to remove the junk:
for /f "tokens=3" %%a in ('dir /-c %1 ^| find /i "%1"') do set Size=%%a
set /a SizeKB=%Size% / 1024
set /a SizeMB=%SizeKB% / 1024
echo Size in bytes: %Size%
echo Size in KB: %SizeKB%
echo Size in MB: %SizeMB%
echo Enter "help for" for more options.
====8<----[FileSize.cmd]--
As for getting the length into a variable, that's rather easy as well in principle, if you have a command line tool that will display this info. If you happen to have a tool, please provide a link or an example output.
Thanks! :) I'm little confused about that script. I have put it into a batch file and ran it, doesn't do much, apart from say it's "missing operand" I guess this is cause I have told it what file I want the size of. Which bit do I need to change for this? Could you possibily add a couple of comments to the lines so I can understand what it's doing better?
Unfortunately, I don't have a command line tool that will display the length of the mp3. If one does exist yes this will be very easy, if not if one could be made that will be fine or a VB script or something. Hope you know how to do this.
Thanks for your help.
Just save it as filesize.cmd, then run it with the filename as argument.
filesize your.mp3
There's actually not too much to comment on;
"%1" is the first argument that's passed to a batch.
You can expand this in several different ways, not only using "%1"; "%~z1", for example, will expand to the file size of the first argument. Simply enter "help call", and you'll see a complete list of possibilities.
The "/a" argument for "set" allows for simple arithmetic calculations. Enter "help set" for a complete list ...
The "for /f" command will parse some output and put the tokens into variables (enter "help for" for, you know ;). You can specify a command in the brackets, and the output of the command will be parsed accordingly. The command in this case as you would enter it directly is "dir /-c SomeFileName.mp3 | find /i "SomeFileName.mp3". The "/c" argument in the "dir" command suppresses the commas in the file size; this output is then passed to 'find /i "SomeFileName.mp3"', which suppresses the "garbage" in the "dir" output and only leaves the file information we're looking for.
Open a command prompt, then enter first "dir SomeFileName.mp3" (well, replace the "SomeFileName" with an existing file, of course), then enter "dir /c SomeFileName.mp3" (compare the file sizes of the output), then enter "dir /-c SomeFileName.mp3 | find /i "SomeFileName.mp3" to see the final output. The "^" in the "for" escapes the pipe symbol ("|").
Have a look at http://www.robvanderwoude.
As for the mp3 information: I've looked around a bit, but couldn't come up with a command line tool; even lame only provides encoding, but doesn't display file information. I'm not really into mp3s, so it might well be possible that there's a tool somewhere that does it, or an expert at Programming might who's familiar with the mp3 format might be able to come up with a small program that displays the information.
I see. Works fine now. Thanks. Sorry to be a pain, but is there a way of altering this so that it can do all that inside a batch file that I already have that does lots of other things. I've found that if I run "filesize %mymp3%" from inside it, it doesn't return to the original batch file to continue processing other commands. Inside this other batch file I have the mp3 in a variable so would be useful if I could add that code to it so that it all runs from within it.
Does that make sense? Sorry if I haven't explained that very well.
I knew about the for, call and set commands, however didn't understand what the help means. I don't think it explains it very well. It just ends up confusing me further.
Your exactly right, I couldn't find a command line tool either. Hence why I have that other question I mentioned at the start of this one. Unfortunately, I don't seem to be getting many responses to that one :(
PS. Did EE completely screw up earlier? I used to use EE a lot in the past and it always did that all the time then....does it still do that?
Yes, seems like it went down. Happens every now and then, but not "all the time".
"mymp3" being the (path and) name of the file in question?
Then use the second possibility from the sample script:
:: *** Put the size in bytes of %mymp3% into mymp3size:
for /f "tokens=3" %%a in ('dir /-c "%mymp3%" ^| find /i "%mymp3%"') do set mymp3size=%%a
:: *** Divide %mymp3size% by 1024*1024 to obtain the size in MB:
set /a mymp3size/=1048576
Great! Thanks alot. Well that's certainly part 1 sorted out.
So you don't think I'm gonna have much luck with part 2 without a programmers knowledge? If maybe we could find a command line mp3 player, then maybe set that to play it and output the total time, then use "for" to extract that into a variable?
Pity no-one is responding to my programming question :(
You don't necessarily need programmers. "All" you need is some command line program that will (in a command prompt) output the playing time of a given mp3 file. It might already be out there, but I don't have the time to search for it. If you find one, I'll be glad to help you to put this into an environment variable.
Yeah I know. I have searched a lot myself, haven't found anything. I'll let you know if I do.
On a slightly different subject, is it possible for a windows application to report back to a batch file?
For example, part of my script runs a ftp program and starts an upload to a certain FTP server. If that FTP server is down I want it to connect to a different one. Trouble is, the ftp program doesn't have this facility. Is there a way of doing this? I expect there is not considering that dos is qutie limited, although surprises me sometimes!
There are two ways for that. Most programs return an errorlevel after execution. This is usually 0 if everything went fine, or some higher value if something went wrong.
@echo off
net view \\NotExisting
if errorlevel 1 echo "The execution failed."
If the program doesn't but returns something useful in the output, you can use "find" to search for it. find returns an errorlevel if it didn't find the string specified. In your situation, you can for example use a ping before actually starting the ftp command:
ping -n 1 ftphost1 | find "TTL" >NUL
if errorlevel 1 (
echo ftphost1 not responding.
goto TrySecondhost
)
With the brackets, you can group some commands together to avoid the "goto".
The errorlevel is a bit tricky: "if errorlevel x" means "if the errorlevel is x *or* *higher*". So if you want to test for errorlevel 0, you have to use "if not errorlevel 1".
The "::" has basically the same effect as a "rem", but it's a bit faster. The interpretes handles is like a label. Have a look at the batch section of th robvanderwoude site, you'll find some useful stuff there.
I see, never knew that :) And the "::" bit makes sense now, so really i could just simply use ":"
I have more questions/problems... shall I just post them here and increase the points or do you want me to create new questions? Doesn't seem much point creating new questions when this is a kind of general batch file questions question (if you see what I mean!) However I know I'm extending this question quite a lot so will increase the points.
Checking the ftp sites are available before connecting to perform transfer, by actually connecting first.
if exist tbs.ftp del tbs.ftp
echo open 10.10.10.10 1000 > tbs.ftp
echo USER Bob >> tbs.ftp
echo bob >> tbs.ftp
echo bin >> tbs.ftp
echo literal >> tbs.ftp
echo quit >> tbs.ftp
ftp -n -s:tbs.ftp | find "Connected" >NUL
del tbs.ftp
if errorlevel 1 (
echo ftphost1 not responding.
goto TrySecondhost
)
Would that work ok?
Also, I want to write a script to copy a load of different files and different directories, keeping the directory structure, to a certain location. However I want to list the files and directories in a txt file and it to read them from it. Just like a configuration file. For example:
===Backup.txt===
C:\Program Files\Backup
D:\Documents
C:\Windows\Tasks
============
How could I do this? I guess it may use that trusty "for" statement again!
Yes, that Robvanderwoude site is pretty good. Tons of stuff on there, hard to find stuff really. Woud be nice if he gave a better idea of what utilites were on each site really.
Thanks for all your help.
You don't need the "del" command at the beginning. If the file exists, it will be overwritten by the "> tbs.ftp" output.
The errorlevel check has to follow directly after the command you want to test; "del" exits with an errorcode as well, which would overwrite the ftp errorlevel.
echo open 10.10.10.10 1000 > tbs.ftp
echo USER Bob >> tbs.ftp
echo bob >> tbs.ftp
echo bin >> tbs.ftp
echo literal >> tbs.ftp
echo quit >> tbs.ftp
ftp -n -s:tbs.ftp | find "Connected" >NUL
if errorlevel 1 (
echo ftphost1 not responding.
goto TrySecondhost
)
goto ftpDone
:TrySecondHost
:: *** another go at another host ...
:ftpDone
del tbs.ftp
As for the copying from an ini file, you can use a construction like this:
set IniFile=S:\ome\where\backu
for /f %%a in ('type "%IniFile%"') do call :process "%%a"
goto leave
:: *** Subroutine "process"
:process
:: *** Extract the source file without quotation marks:
set Source=%~1
:: *** Extract *P*ath, *N*ame, and e*X*tension of the source file:
set Target=%~pnx1
:: *** Add the target drive:
set Target=X:%Target%
xcopy "%Source%" "%Target%" <Add your options here>
goto :eof
:: *** End subroutine "process"
:leave
The call :label is a way to simulate a subroutine call in a batch file (well, as nearly all the stuff described here, not for Win9x or plain DOS ...) The interpreter will jump to the label, pass any given arguments, continue until the end of the script ("goto :eof", which I reserve for the return of a "subroutine"), then return to the line after the "call :label".
Another useful trick is the ('type "%IniFile%"') in the "for /f" command, because you can handle paths with spaces in it that way. If you don't use quotation marks, the interpreter will try to look for the file until the space (and fail miserably), if you use quotation marks, the interpreter will handle the given path as a string, not as a file.
Ok I'm trying something else, but it's not working. I guess it needs another one of those for commands...
====makefile.bat=====
set title=
set name=
set date=
set time=
type blank.txt > test.txt
=================
====blank.txt========
Title is %title%
Name is %name%
Date is %date%
Time is %time%
=================
Basically I'm running makefile.bat and want it to create test.txt from blank.txt with the variable values. However all I get is a copy of blank.txt with the variable names not whats in the variables.
How can I do this successfully?
I seem to find that it does most of the time :(
Well, that is just a sample of blank.txt. It actually has a lot of other stuff all around that. By stuff I mean, ASCII art. It's just the way it has to look.
For example:
ßßß Ü²ÛÛÛÛ ÛÛÛÛ²Ü ßßß
Üܲ²²ÛÛÛÛÛÛ ÛÛÛÛÛÛ²²²ÜÜ
²²ÛÛÛÛÛÛÛßß Title.......[ %title% ßßÛÛÛÛÛÛÛ²²
²²ÛÛÛßß Ü Name........[ %name% Ü ßßÛÛÛ²²
ܲÛÛÛ ÜÛ ²ÛÜ Date........[ %date% ÜÛ² ÛÜ ÛÛÛ²Ü
²²ÛÛ Ûß ²Û YEAR.........[ 2004 Û² ßÛ ÛÛ²²
²²ÛÛÛÜ ÜÛÛß ßÛÛÜ ÜÛÛÛ²²
²²ÛÛÛÛÛÛß ßÛÛÛÛÛÛ²²
ß²²ÛÛÛÛ ÛÛÛÛ²²ß
²²²ÛÛÛÛÛÜÜ ÜÜÛÛÛÛÛ²²²
ßßß ÛÛÛÛÛÛÛÜ ÛÛßÛ ÛÛßßßÛÛ ÛÜ ÛßÛÛßÛßßÛÛßßÛÛßß ÛÛßß ÜÛÛÛÛÛÛÛ ßßß
ܲ²ÜÛÛ²²ßß²Û ²ÛÜß ²Ûß ²Û ²ÛÛÛ ²Û Û ²Û ²Ûß ßßßÛ ²Û²ßß²²ÛÛܲ²Ü
²ÛÛÛÛÛ²² Û ²Û ÛܲÛÛÛ ²ÛÛÛÜ²Û Û ²ÛÛÛ ²Û ²ÛÛÛܲÛÛÛ ²Û ²²ÛÛÛÛÛ²
²Ûß ß²² ²²ß ßÛ²
That just gives you an idea, although may not look exactly right on here, due to formatting. So is there any way to do this?
Any ideas with that oBdA?
I've been playing with the checking of the FTP sites:
echo open 100.100.100.100 > uk2.ftp
echo USER bob >> uk2.ftp
echo pass >> uk2.ftp
echo quit >> uk2.ftp
ftp -n -s:uk2.ftp | find "Connected"
if errorlevel 0 goto upload
if errorlevel 1 goto checknextsite
However, this doesn't seem to work. It always goes to upload, whether it connects or not. I have tired with the >NUL bit aswell, but made no difference and with it on I can't see whats happening.
Have I done it wrong somewhere?
As I said before: "if errorlevel x" means "if the errorlevel is x *or* *higher*".
Checking for errorlevel 0 doesn't make sense; that's *always* true. If you want to check for different errorlevels, you have to do so in revese order, the higher ones first.
Use the example I alread posted on 01/27/2004 12:14PM PST; put the routine for the next host where it says
:: *** another go at another host ...
Expand this for as many hosts as you need.
As for the ASCII graphics, that's theoretically doable, but it'll turn out an ugly mess. You'll need to get the string length as well to not distort the graphics, so it's probably easier to create this separately.
Ok. Thanks. I've been playing about with a few things. Hopefully this question won't go on too much longer if all goes to plan :)
Decided to do the "Title is %Title% >test.txt" way, it simplier. But I've noticed that it doesn't like "&" symbols, probably cause they are used in the code, is there a way around this? I've noticed before in HTML code there are sometimes slashes before these characters, not sure if I need to do that.
Also, is there a way of echoing the last few lines of a log file to another file? Only specifying the last 10 lines for example?
The checking of the FTPs seems to be working now, but now the problem is that some of them are secure ones and I haven't found a command line FTP that support SSL/TLS. Without this is won't allow logon. Any ideas how to overcome this? Unless somehow I can find a way to capture the errorlevel from FlashFXP, when it can't connect for example?
Still got the problem of getting the length in time of the mp3 into a variable. Not sure how to overcome this. Can't find anything to do it!
Cheers!
You can use the "&" symbol to put two commands into one line, like, for example, echo Line 1 & echo Line 2. This will not echo "Line 1 & echo Line 2", it will echo both lines. The escape character in a command shell is usually "^" (to output a "%", duplicate it).
echo Echoing an ampersand: ^&
echo Echoing a percent sign: %%
For the "x last lines" to work, you'll need to passes: One to get the number of lines in the original file, then output the desired number of lines.
The easiest way to do this is using "find" and "more", with some additional stuff for the caveats involved; here's an example:
@echo off
setlocal
:: *** The file of which the last lines to print:
set InFile=D:\Temp\test.cmd
:: *** The number of lines to show:
set LastLines=10
:: *** Check for a ":" in the file name; the ":" of the "find" output is used as delimiter, so the token number might have to be adjusted.
set Token=3
if "%InFile%"=="%InFile::=%" set Token=2
:: *** Get the numbr of lines in the file using "find"
for /f "tokens=%Token% delims=:" %%a in ('find /v /c "" "%InFile%"') do set TotalLines=%%a
echo Lines in %InFile%: %TotalLines%
:: *** Subtract the number of lines to be printed to get the number of lines to skip:
set /a SkipLines=TotalLines-LastL
if %SkipLines% LSS 0 set SkipLines=0
echo Skipping %SkipLines% lines in the following output:
:: *** Use "more +n" to skip the unnecessary lines:
type "%InFile%" | more +%SkipLines%
As for the ftp problem, I'm afraid I don't have a recommendation either.
As for the mp3 length, the best solution is probably to post a specific request in the programmer's section. All the program needs to do is take an mp3 file name as argument and print the length of the file; seems doable (well, easy thing for me to say since I don't know anything about th mp3 format ...). You might add a 20 points pointer in the Applications/Multimedia section offering the the "programming" points for a an existing program that can do this.
Great! Thanks. I'll try out that script in a bit.
Something else that I was playing with (that I thought would be easy) does seem to work...
I put the following in a batch file:
xcopy /t /e D:\ C:\Progra~1\Batch\Backup\D
Because I don't have enough room to backup the whole of my D: drive, so I thought I'd backup all the dirs. That way, it gives me an idea of whats on there and also a record base. However, whenever I run this it starts it, and does quite a lot of it, until suddenly comes up with "insufficent memory" and stops.
I've tried separating out the directories, into different commands, but same thing happens after a little while. Some of them do have a lot of folders in them, but still, seems a bit werid. Any way around this?
Is that machine on the current SP level?
You May Not Be Able to Copy Large Files on Computers That Are Running Windows NT 4.0 or Windows 2000
http://support.microsoft.c
Otherwise try to run it with the /L switch (which will list the files to be copied, but not actually copy them) and see where it stops.
> The checking of the FTPs seems to be working now, but now the problem is that some of them are secure ones and I haven't found a command > line FTP that support SSL/TLS. Without this is won't allow logon. Any ideas how to overcome this? Unless somehow I can find a way to capture > the errorlevel from FlashFXP, when it can't connect for example?
Also, thought I'd mention that I found a solution to the above, just in case your interested. I have found 2 utilities, TLSWrap and WinSSL. Both setup a type of FTP proxy server, on the local port (127.0.0.1) and a port you specify. You then connect to this hostname:port using FTP software and in the username field put: username@secureftphostname
Now at least that's solved.
I have actually found some PAQs on here that seem to be similar to what I need for the mp3 length. However, because they are PAQ I need to be a premium user to read the answers! I wish they offered a $1/answer solution or something. Don't suppose you are a premium user are you?
Ok I got an another small query for you....
Can you use dos to parse text files?
Let me explain...I download a webpage tracklisting every week, but of course this webpage contains a lot of other information that I don't need. Is there a way to setup a script so that it looks at the downloaded web page and analyises it. Looks for a certain phrase such as "Tracklisting 11/02/04" and copies all the text from that point. Sometimes, the tracklisting isn't updated and therefore the previous weeks tracklist is on the site, so I need it to identify the date and only copy the text if the date matches the current date (which I do have in variables %day% %month% %year%). I really then need to get each line of this tracklisting into a variable so that I can add it to my section with the ASCII art and where it echoing other information into a text file.
I realise this is quite a lot, but of what I've seen it should be possible, shouldn't it?
Thanks alot :)
Someone in my programming question for the mp3 length has responded!
http://www.experts-exchang
I've tested it using one of my sample mp3s:
==========================
No edits specified; only reading input data
Creating index file D:/Test.idx
Elapsed time: 0:01| 1.018s|Frame: 39
Elapsed time: 0:02| 2.011s|Frame: 77
Elapsed time: 0:03| 3.004s|Frame: 115
Elapsed time: 0:04| 4.022s|Frame: 154
Elapsed time: 0:05| 5.015s|Frame: 192
Elapsed time: 0:06| 6.008s|Frame: 230
Elapsed time: 0:07| 7.000s|Frame: 268
Elapsed time: 0:08| 8.019s|Frame: 307
Elapsed time: 0:09| 9.012s|Frame: 345
Elapsed time: 0:10| 10.004s|Frame: 383
Elapsed time: 0:11| 11.023s|Frame: 422
Elapsed time: 0:12| 12.016s|Frame: 460
Elapsed time: 0:13| 13.008s|Frame: 498
Elapsed time: 0:14| 14.001s|Frame: 536
Elapsed time: 0:15| 15.020s|Frame: 575
Elapsed time: 0:16| 16.012s|Frame: 613
Elapsed time: 0:17| 17.005s|Frame: 651
Elapsed time: 0:18| 18.024s|Frame: 690
Elapsed time: 0:19| 19.016s|Frame: 728
Elapsed time: 0:20| 20.009s|Frame: 766
Elapsed time: 0:21| 21.002s|Frame: 804
Elapsed time: 0:22| 22.020s|Frame: 843
Elapsed time: 0:23| 23.013s|Frame: 881
Elapsed time: 0:24| 24.006s|Frame: 919
Elapsed time: 0:25| 25.024s|Frame: 958
Elapsed time: 0:26| 26.017s|Frame: 996
Elapsed time: 0:27| 27.010s|Frame: 1034
Elapsed time: 0:28| 28.002s|Frame: 1072
Elapsed time: 0:29| 29.021s|Frame: 1111
Elapsed time: 0:30| 30.014s|Frame: 1149
Elapsed time: 0:31| 31.006s|Frame: 1187
Elapsed time: 0:32| 32.025s|Frame: 1226
Elapsed time: 0:33| 33.018s|Frame: 1264
Elapsed time: 0:34| 34.010s|Frame: 1302
Elapsed time: 0:35| 35.003s|Frame: 1340
Elapsed time: 0:36| 36.022s|Frame: 1379
Elapsed time: 0:37| 37.014s|Frame: 1417
Elapsed time: 0:38| 38.007s|Frame: 1455
Elapsed time: 0:39| 39.000s|Frame: 1493
Elapsed time: 0:40| 40.018s|Frame: 1532
Elapsed time: 0:41| 41.011s|Frame: 1570
Elapsed time: 0:42| 42.004s|Frame: 1608
Elapsed time: 0:43| 43.022s|Frame: 1647
Elapsed time: 0:44| 44.015s|Frame: 1685
Elapsed time: 0:45| 45.008s|Frame: 1723
Elapsed time: 0:46| 46.000s|Frame: 1761
Elapsed time: 0:47| 47.019s|Frame: 1800
Elapsed time: 0:48| 48.012s|Frame: 1838
Elapsed time: 0:49| 49.004s|Frame: 1876
Elapsed time: 0:50| 50.023s|Frame: 1915
Elapsed time: 0:51| 51.016s|Frame: 1953
Elapsed time: 0:52| 52.008s|Frame: 1991
Elapsed time: 0:53| 53.001s|Frame: 2029
Elapsed time: 0:54| 54.020s|Frame: 2068
Elapsed time: 0:55| 55.012s|Frame: 2106
Elapsed time: 0:56| 56.005s|Frame: 2144
Elapsed time: 0:57| 57.024s|Frame: 2183
Elapsed time: 0:58| 58.016s|Frame: 2221
Elapsed time: 0:59| 59.009s|Frame: 2259
Elapsed time: 1:00| 60.002s|Frame: 2297
Elapsed time: 1:01| 61.020s|Frame: 2336
Elapsed time: 1:02| 62.013s|Frame: 2374
Elapsed time: 1:03| 63.006s|Frame: 2412
Elapsed time: 1:04| 64.025s|Frame: 2451
Elapsed time: 1:05| 65.017s|Frame: 2489
Elapsed time: 1:06| 66.010s|Frame: 2527
Elapsed time: 1:07| 67.002s|Frame: 2565
Elapsed time: 1:08| 68.021s|Frame: 2604
Elapsed time: 1:09| 69.014s|Frame: 2642
Elapsed time: 1:10| 70.006s|Frame: 2680
Elapsed time: 1:11| 71.025s|Frame: 2719
Elapsed time: 1:12| 72.018s|Frame: 2757
Elapsed time: 1:13| 73.010s|Frame: 2795
Elapsed time: 1:14| 74.003s|Frame: 2833
Elapsed time: 1:15| 75.022s|Frame: 2872
Elapsed time: 1:16| 76.015s|Frame: 2910
Elapsed time: 1:17| 77.007s|Frame: 2948
Elapsed time: 1:18| 78.000s|Frame: 2986
Elapsed time: 1:19| 79.019s|Frame: 3025
Elapsed time: 1:20| 80.011s|Frame: 3063
Elapsed time: 1:21| 81.004s|Frame: 3101
Elapsed time: 1:22| 82.023s|Frame: 3140
Elapsed time: 1:23| 83.015s|Frame: 3178
Elapsed time: 1:24| 84.008s|Frame: 3216
Elapsed time: 1:25| 85.000s|Frame: 3254
Elapsed time: 1:26| 86.019s|Frame: 3293
Elapsed time: 1:27| 87.012s|Frame: 3331
Elapsed time: 1:28| 88.005s|Frame: 3369
Elapsed time: 1:29| 89.023s|Frame: 3408
Elapsed time: 1:30| 90.016s|Frame: 3446
Elapsed time: 1:31| 91.009s|Frame: 3484
Elapsed time: 1:32| 92.001s|Frame: 3522
Elapsed time: 1:33| 93.020s|Frame: 3561
Elapsed time: 1:34| 94.013s|Frame: 3599
Elapsed time: 1:35| 95.005s|Frame: 3637
Elapsed time: 1:36| 96.024s|Frame: 3676
Elapsed time: 1:37| 97.017s|Frame: 3714
Elapsed time: 1:38| 98.009s|Frame: 3752
Elapsed time: 1:39| 99.002s|Frame: 3790
Elapsed time: 1:40| 100.021s|Frame: 3829
Elapsed time: 1:41| 101.013s|Frame: 3867
Elapsed time: 1:42| 102.006s|Frame: 3905
Elapsed time: 1:43| 103.025s|Frame: 3944
Elapsed time: 1:44| 104.017s|Frame: 3982
Elapsed time: 1:45| 105.010s|Frame: 4020
Elapsed time: 1:46| 106.003s|Frame: 4058
Elapsed time: 1:47| 107.021s|Frame: 4097
Elapsed time: 1:48| 108.014s|Frame: 4135
Elapsed time: 1:49| 109.007s|Frame: 4173
Elapsed time: 1:50| 110.025s|Frame: 4212
Elapsed time: 1:51| 111.018s|Frame: 4250
Elapsed time: 1:52| 112.011s|Frame: 4288
Elapsed time: 1:53| 113.003s|Frame: 4326
Elapsed time: 1:54| 114.022s|Frame: 4365
Elapsed time: 1:55| 115.015s|Frame: 4403
Elapsed time: 1:56| 116.007s|Frame: 4441
Elapsed time: 1:57| 117.000s|Frame: 4479
Elapsed time: 1:58| 118.019s|Frame: 4518
Elapsed time: 1:59| 119.011s|Frame: 4556
Elapsed time: 2:00| 120.004s|Frame: 4594
Elapsed time: 2:01| 121.023s|Frame: 4633
Elapsed time: 2:02| 122.015s|Frame: 4671
Elapsed time: 2:03| 123.008s|Frame: 4709
Elapsed time: 2:04| 124.001s|Frame: 4747
Elapsed time: 2:05| 125.019s|Frame: 4786
Elapsed time: 2:06| 126.012s|Frame: 4824
Elapsed time: 2:07| 127.005s|Frame: 4862
Elapsed time: 2:08| 128.023s|Frame: 4901
Elapsed time: 2:09| 129.016s|Frame: 4939
Elapsed time: 2:10| 130.009s|Frame: 4977
done.
File name: D:\Test.mp3
CBR: 192
Total frames: 5014
File size: 3143471
Track length: 2:10.975 (130s)
==========================
And thats with a 2minute long mp3!! A lot of stuff that needs to be cut out, or ignored! So basically all we need to go is capture the bit of "Track length: 2:10.975 (130s)" the "2:10" bit only.
Hope this be possible!
I would increase the points further, but there isn't the option for it. I will post another question after this one to give you more points for all your help as I keep asking more and more things.
Thanks again :)
Okay, retrieving the track length is rather easy now:
for /f "tokens=3 delims=. " %%a in ('S:\ome\Path\mpgedit.exe %YourMP3File% ^| find /i "Track length"') do set Length=%%a
echo Length: [%Length%]
Note that there is a space between 'delims=.' and the closing quotation mark, and you need of course to adjust the "mpgedit" command.
As for downloading and parsing the website, that should be doable, but that should be put into a different question; it's not about the points for me, but it's not connected to the initial question any more and it makes it harder for people looking for similar problems to find what they're looking for. Not to mention that others should have a chance to participate in your questions as well ;)
If you decide to ask another question, feel free to post a link to it here.
Great, that worked brilliantly! :)
Ok fair enough, I'll post another question for the file parsing. Shall I post it in this section or the programming section? I do really need it done in dos again, so here would be best.
Well all thats left to do is the parsing and part 2 of that other programming question.
Thanks for all your help, it's been extremely helpful!
Cheers :D
Business Accounts
Answer for Membership
by: dbruntonPosted on 2004-01-23 at 22:17:27ID: 10189918
If you are running Windows NT the first question can be solved.
One of the good experts here can do that. But not me. My dos isn't that good.
The second one probably requires the creation of a util to extract that information from the file and I don't think there's a dos command to do that.