Jump to content

Recommended Posts

Inside one folder i have around 200 folder's and each folder's having 150 mp3 files.

I want to get metadata of each mp3 file's 

below is the code which i have tried but getting below error.

Fatal error: Uncaught exception 'UnexpectedValueException' with message 'RecursiveDirectoryIterator::__construct(C:\Users\Desktop\Rajesh song,C:\Users\Desktop\Rajesh song): The system cannot find the path specified. (code: 3)' in C:\xampp\htdocs\getID3-master\rajupal.php:4 Stack trace: #0 C:\xampp\htdocs\getID3-master\rajupal.php(4): RecursiveDirectoryIterator->__construct('C:\\Users\\Deskto...') #1 {main} thrown in C:\xampp\htdocs\getID3-master\rajupal.php on line 4

<?php
include("getid3/getid3.php"); 
$directory = 'C:\Users\Desktop\Rajesh song';
$filename = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($directory));
while($filename->valid()) {
if (!$filename->isDot()) {
$getID3 = new getID3;
$file = $getID3->analyze($filename);
//print_r($file);
$playtime_seconds = $file['playtime_seconds'];
$dumpa=gmdate("H:i:s", $playtime_seconds);
$filesize = $file['filesize'];
$filepath = $file['filepath'];
$filename = $file['filename'];
$filename1 = $file['fileformat'];
echo "<table class='table table-striped'>";
echo "<tr>";
echo "<th>File Path</th>";
echo "<th>Name</th>";
echo "<th>Size(kb)</th>";
echo "<th>Duration</th>";      
echo "<th>File Type</th>";
echo "</tr>";
echo "<tr>";
echo "<td> ".$filepath."</td>";
echo "<td> ".$filename."</td>";
echo "<td> ".$filesize."</td>";
echo "<td> ".$dumpa."</td>";      
echo "<td> ".$filename1."</td>";      
echo "</tr>";
echo "</table>";
}
$filename->next();
}
?>

 

Edited by sapnawat

Hi gw1500se,

Thanks for the reply.

I have change path to $directory = "C:\Users\%username%\Desktop\Rajesh song"; but still getting error.

 

Fatal error: Uncaught exception 'UnexpectedValueException' with message 'RecursiveDirectoryIterator::__construct(C:\Users\%username%\Desktop\Rajesh song,C:\Users\%username%\Desktop\Rajesh song): The system cannot find the path specified. (code: 3)' in C:\xampp\htdocs\getID3-master\rajupal.php:4 Stack trace: #0 C:\xampp\htdocs\getID3-master\rajupal.php(4): RecursiveDirectoryIterator->__construct('C:\\Users\\%usern...') #1 {main} thrown in C:\xampp\htdocs\getID3-master\rajupal.php on line 4

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.