Sponsored Content
Top Forums Shell Programming and Scripting Function to get the duration of all videos in a folder(s) Post 303016235 by MadeInGermany on Monday 23rd of April 2018 04:35:18 AM
Old 04-23-2018
The classic approach is slow (run exiftool for each file) but safe:
Code:
total_folder_length=$(
  find . -maxdepth 1 -type f \( -iname '*.mkv' -o -iname '*.mp4' -o -iname '*.avi' \) |
  while IFS= read -r fname 
  do
    exiftool -n -q -p '$Duration#' "$fname"
  done |
  awk '{sum+=$0} END {print sum+0}'
)

Only -maxdepth 1 prints the start directory, so I added -type f

Last edited by MadeInGermany; 04-23-2018 at 06:17 AM.. Reason: added -type f
This User Gave Thanks to MadeInGermany For This Post:
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

duration calculation

I have a file which has 3 coloumns emp_name, Joining_date, Designation. abc 12/1/2001 SSE def 2/25/2007 SE ghi 3/18/2009 SA abc 8/1/2008 SSE def 2/13/2007 SE ghi 3/24/2005 SA I need to find out the emp who has been in the company for longest period(Till date). Can I have any... (3 Replies)
Discussion started by: siba.s.nayak
3 Replies

2. Solaris

ufsdump backup duration

hi, i'm trying to figure out how to tell the amount of time a ufsdump of a directory takes. i use the below command: echo "Starting Backup of u4" >> /backup/backup.log 2>&1 /usr/sbin/ufsdump 0uf /dev/rmt/0n /u4 >> /backup/backup.log 2>&1 echo "Finished Backup of u4" >> /backup/backup.log... (0 Replies)
Discussion started by: pinoy43v3r
0 Replies

3. Shell Programming and Scripting

Get password protected URL folder using PHP fopen function

Hi everybody, Please some help over here, I`m pretty new in PHP. I have a cronrefresh php file within a website, I need this script get infornation from a URL of the site. Part of the script where $URL variable appears is: $fdURL = mysql_query("SELECT * FROM affiliSt_config WHERE name... (2 Replies)
Discussion started by: cgkmal
2 Replies

4. UNIX for Dummies Questions & Answers

Copy duration of cp

Hello forum, i would like to ask if there's a way to view the remaining time of copying files (talking about copying gigabytes) while the cp commnad is running. I'm using OpenBSD 4.9 -stable. Thanx in advance. :) (2 Replies)
Discussion started by: sepuku
2 Replies

5. Shell Programming and Scripting

Convert duration of the process to seconds

Hi, I am looking to write a script to kill the process which are running for more than 7 days. So i have a command like "ps -eo pid,etime,args | grep -i xxxx" ( process which has xxx in it and running for more than 7 days needs to be killed ). When i exeucte the above command , i am... (2 Replies)
Discussion started by: forums123456
2 Replies

6. UNIX Desktop Questions & Answers

arecord not interrupted after specified duration

I have used the arecord command like this arecord -d 1 test.wav It is keep on waiting. I need to manually interrupt it by ctrl-c. Why it is not interrupting after one second? The arecord version which I am using is : arecord: version 1.0.23 by Jaroslav Kysela (3 Replies)
Discussion started by: thillai_selvan
3 Replies

7. Shell Programming and Scripting

Sort by Duration

.......................................................................................................................... 03:40 Geonetric File from CCL Complete 03:40:59 03:41:08 00:00:09 00:00:01 N/A 005 sys_runccl ... (7 Replies)
Discussion started by: Daniel Gate
7 Replies

8. UNIX for Beginners Questions & Answers

Process duration

Hi , How can I check that for a single process, for example pagent for how much duration this process was up or down and also I need multiple entries if this process was down or up multiple times. Please help. (3 Replies)
Discussion started by: Ashish Garg
3 Replies

9. Shell Programming and Scripting

Duration Calculation

I have 2 variables startTime='122717 23:20' endTime='122817 0:40' how can i get the elapsed duration as like "1 hour 20 minutes" ? (8 Replies)
Discussion started by: vikram3.r
8 Replies
OSGMLNORM(1)							     Reference							      OSGMLNORM(1)

NAME
osgmlnorm - An SGML/XML document normalizer SYNOPSIS
osgmlnorm [-CdeghmnrRvx] [-alinktype] [-Aarchitecture] [-bbctf] [-ccatalog] [-Ddirectory...] [-Emax_errors...] [-iname...] [-fname...] [-wwarning...] [sysid...] DESCRIPTION
osgmlnorm prints on the standard output a normalized document instance for the SGML document contained in the concatenation of the entities with system identifiers When the normalized instance is prefixed with the original SGML declaration and prolog, it will have the same ESIS as the original SGML document, with the following exceptions: * The output of osgmlnorm does not protect against the recognition of short reference delimiters, so any USEMAP declarations must be removed from the DTD. * The normalized instance will use the reference delimiters, even if the original instance did not. * If marked sections are included in the output using the -m option, the reference reserved names will be used for the status keywords even if the original instance did not. * Any ESIS information relating to the SGML LINK feature will be lost. The normalized instance will not use any markup minimization features except that: * Any attributes that were not specified in the original instance will not be included in the normalized instance. (Current attributes will be included.) * If the declared value of an attribute was a name token group, and a value was specified that was the same as the name of the attribute, then the attribute name and value indicator will be omitted. For example, with HTML osgmlnorm would output <DL COMPACT> rather than <DL COMPACT="COMPACT"> Part of an SGML System Conforming to International Standard ISO 8879 -- Standard Generalized Markup Language. An SGML Extended Facilities system conforming to Annex A of International Standard ISO/IEC 10744 -- Hypermedia/Time-based Structuring Language. The following options are available: -aname, --activate=name Make doctype or linktype name active. -Aarchitecture, --architecture=architecture Parse with respect to architecture architecture. -bbctf, --bctf=bctf Use the BCTF with name bctf for output. -csysid, --catalog=sysid Map public identifiers and entity names to system identifiers using the catalog entry file whose system identifier is sysid. -C, --catalogs This has the same effect as in onsgmls(1). -d, --dtd Output a document type declaration with the same external identifier as the input document, and with no internal declaration subset. No check is performed that the document instance is valid with respect to this DTD. -Ddirectory, --directory=directory Search directory for files specified in system identifiers. This has the same effect as in onsgmls(1). -e, --open-entities Describe open entities in error messages. --error-numbers Show error numbers in error messages. -h, --help Display a help text and exit. -iname, --include=name This has the same effect as in onsgmls(1). -m, --marked-sections Output any marked sections that were in the input document instance. -n, --comments Output any comments that were in the input document instance. -r, --raw Raw output. Don't perform any conversion on RSs and REs when printing the entity. The entity would typically have the storage manager attribute records=asis. -R, --restricted This has the same effect as in onsgmls(1). -v, --version Print the version number. -wtype Control warnings and errors according to type. This has the same effect as in onsgmls(1). SEE ALSO
onsgmls(1), ospam(1), ospent(1), osx(1) AUTHORS
James Clark Author. Ian Castle <ian.castle@openjade.org> Author. COPYRIGHT
OpenJade January 2002 OSGMLNORM(1)
All times are GMT -4. The time now is 06:05 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy