This is really the wrong list for this. PHP-DEV is about developing PHP, not developing WITH PHP. BUT since I like your username 'phpmonkey' here's how ya'd do it. (untested of course, but the general idea) :)
<?php $handle=opendir('/path/to/files'); while (false !== ($file = readdir($handle))) { if (preg_match("/(.*) - (.*).mp3/i", $file, $matches)) { $artist = $matches[1]; $song = $matches[2]; // insert into db } } ?> -Chris -----Original Message----- From: Jason Dubya [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 28, 2002 4:34 PM To: [EMAIL PROTECTED] Subject: [PHP-DEV] Parsing File Names I am trying to create a script that will crawl through a directory, take each file name, and parse it to get information from the filename. This is going to be used to place artists and song names into a database. The filenames are all in the following format: artist - songname.mp3 Is there an easy way to parse that to create two variables: $artist & $songname? -- Jason Dubya -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, visit: http://www.php.net/unsub.php