until [ -z "$1" ]
do
if [ -d "$1" ]; then
if [ `find "$1" -type f | wc -l` -ne 0 ]; then
echo "$1 is not empty";
else
echo "$1 is empty";
fi
fi
shift
done
$ ~/tmp/is_empty.sh *
1208 is not empty
Acdc is not empty
Afterbeat is empty
Anti-Flag is not empty
Arch Enemy is not empty
Arol is not empty
...
$ cd /mnt/ipod/iPod_Control/iTunes
$ cp `cat iTunesDB.ext | grep -A3 "filename_locale.*Afterbeat" | grep filename_ipod | sed "s|.*=|/mnt/ipod/|" | sed "s|:|/|g"` ~/tmp/Afterbeat/
Maybe you should write a bash script to do that :PHeh, that'd be slick. I don't think there's an id3 reader that comes with Linux, though, otherwise I could. I'm sure there's a commandline one out there, though, that I could script up!
php printid3info.php -i -l /Users/william/Documents/Programming/php/getid3-1.7.9/getid3/getid3.php -f %artist, %album, %year, %genre, %title < printid3list.txt
/Users/william/Music/iTunes/iTunes Music/Music/Anberlin/Lost Songs/01 The Haunting.mp3
/Users/william/Music/iTunes/iTunes Music/Music/Journey/Journey's Greatest Hits/02 Don't Stop Believin'.m4a
/Users/william/Music/iTunes/iTunes Music/Music/Rick Astley/Whenever You Need Somebody/01 Never Gonna Give You Up.mp3
Library path switched to: /Users/william/Documents/Programming/php/getid3-1.7.9/getid3/getid3.php
Format set: %artist, %album, %year, %genre, %title
Enter absolute filename: Anberlin, Lost Songs, 2007, Other, The Haunting
Enter absolute filename: Journey, Journey's Greatest Hits, %year, %genre, Don't Stop Believin'
Enter absolute filename: Rick Astley, Whenever You Need Somebody, 1987, Other, Never Gonna Give You Up
Enter absolute filename: Error opening
#!/bin/php
<?php
//
// ID3 Tag Info Printer
// Written by joe[x86]
// Based on getID3 by James Heinric
// http://www.getid3.org
//
// set defaults
$libpath = "/usr/include/getid3/getid3.php";
$format = "%artist - %title";
// parse commandline input
for ($i = 1; $i < $argc; $i++) {
if ($argv[$i] == "-h") {
echo "Usage: php printid3info.php [-h | -v | -l libpath | -f format]\n";
echo "-h: Help. Displays this message.\n";
echo "-v: Verbose. Incomplete.\n";
echo "-l: Library path.";
echo "-f format: Replaces the following format codes:\n";
echo " %title, %artist, %album, %year, %track, %genre\n";
echo " Uses \"%artist - %title\\n\" by default. Must be last argument\n";
die();
} else if ($argv[$i] == "-v") {
echo "Verbose mode not complete.\n";
} else if ($argv[$i] == "-l") {
$i++;
$libpath = $argv[$i];
echo "Library path switched to: $libpath\n";
} else if ($argv[$i] == "-f") {
// begin accepting format
$format = "";
for ($j = $i + 1; $j < $argc; $j++) {
$format .= " " . $argv[$j];
}
$format = trim($format);
echo "Format set: $format\n";
}
}
// include library
if(@!include($libpath))
die("Missing getID3 library at $libpath\n");
$getID3 = new getID3;
while(true) {
echo "Enter absolute filename: ";
$filename = trim(fgets(STDIN));
$fileinfo = $getID3->analyze($filename);
getid3_lib::CopyTagsToComments($fileinfo);
if (array_key_exists('comments', $fileinfo)) {
$output = $format;
if (array_key_exists("title", $fileinfo['comments']))
$output = str_replace("%title", $fileinfo['comments']['title'][0], $output);
if (array_key_exists("artist", $fileinfo['comments']))
$output = str_replace("%artist", $fileinfo['comments']['artist'][0], $output);
if (array_key_exists("album", $fileinfo['comments']))
$output = str_replace("%album", $fileinfo['comments']['album'][0], $output);
if (array_key_exists("year", $fileinfo['comments']))
$output = str_replace("%year", $fileinfo['comments']['year'][0], $output);
if (array_key_exists("track", $fileinfo['comments']))
$output = str_replace("%track", $fileinfo['comments']['track'][0], $output);
if (array_key_exists("genre", $fileinfo['comments']))
$output = str_replace("%genre", $fileinfo['comments']['genre'][0], $output);
echo $output . "\n";
} else {
echo "Error opening $filename\n";
die();
}
// display all variables
/*foreach($fileinfo['comments'] as $key => $value) {
echo "$key => $value\n";
}*/
}
?>
Bump!
find -depth -type d -empty
What do I win?