Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

How to copy a list of file names to text file?

I am linking the above page because of its relevance to my question.

Is there anything similar that can be done to output a 'plain' looking text file (or XML or CSV file) with basically the same data that the following CMD prompt produces:

dir > c:\list.txt

However, the only difference I need is the run-time of any and all video files included in the outputted file. Can this easily be done?

Can this be done in the Python terminal or Microsoft's DOS prompt?

share|improve this question
    
type a.csv <-- is that what you want? –  barlop Sep 2 '12 at 19:26
    
But the "dir > c:\jjj.txt" doesn't tell me the video's length. And this may pose another problem but my videos are of all different extentions: .mp4 .avi .mkv etc... I do not know what kind of problems that will bring upon me... –  Adam Johnston Sep 2 '12 at 20:10

1 Answer 1

old answer
copy /B file1+file2 file3

revised answer

Use mediainfo , download it. Here is the command line version.

C:\>mediainfo file.wmv | find "Duration"
Duration                                 : 14mn 3s
Duration                                 : 14mn 3s
Duration                                 : 14mn 3s

You can also do | find "name" and get the name.

You could just grab the first line, so | head -n 1 (head requires gnuwin32), and you could just grab the 14mn 3s

C:\>for /f "tokens=1-2,*" %f in ('mediainfo "a.wmv" ^| find "Duration"')
 do @echo %h
14mn 3s
14mn 3s
14mn 3s

You can redirect to a file.

If you put this bat file into the same directory as your videos

Here i've used the head command from gnuwin32. but if you remove | head -n 1, you'll still get the idea.

a.bat

for %%f in (*.*) do (
echo %%f >>y
 mediainfo %%f | find "Duration" | head -n 1 >>y
echo. >>y
)


C:\>type y
a.bat

file1.wmv
Duration                                 : 30s 0ms

file2.wmv
Duration                                 : 45s 11ms
share|improve this answer
    
you can try type, type a.a b.b >c.c That might work but it's possible type will change stuff so check the file size of the final file. It might work. But copy/b will definitely do it fine. this says microsoft.com/resources/documentation/windows/xp/all/proddocs/… "In general, avoid using the type command to display binary files." but it may be ok i haven't tested it enough. –  barlop Sep 2 '12 at 19:38
    
I think you may be mistaken... That made a copy of the video file. I'm looking for the creation of a text document listing the video length or run time of said video(s) in hours or minutes... –  Adam Johnston Sep 2 '12 at 20:09
    
@AdamJohnston oh I didn't understand your question, hadn't heard the expression video runtime, I see it exists, it gets 225,000 results. But video length gets 6.7 million results. i'll edit my answer –  barlop Sep 2 '12 at 22:08

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.