Delete files not named x and not in folder named z
Posted: 09 Sep 2021 04:38
So I'm tidying up the artwork in my music collection. Over the years I've ended up with all sorts of name for just one image - folder.jpg, artist-album.jpg, album-artist.jpg, etc. I want to get rid of any that aren't named folder.jpg. But, some artists have folders named Singles and I want to leave all jpg files in those folders regardless of name. My music folder structure is as follows:
I'd like to branch view an artist folder (or, ideally, the whole music folder) and delete any jpg that is a) not named folder.jpg AND b) not in a folder named Singles. I have this script at the moment and it works but I can only use it on artists with no Singles folder because it deletes all image files not named folder.jpg:
I've been trying to figure out how to add !="Singles" but I can't get it to work. I don't know if that's because I've gone about it the wrong way, or if it's something to do with my selectitems code. Here's what I can remember of what I've tried:
This is frustrating the heck out of me. Can someone please help me out? TIA :-)
Code: Select all
MUSIC\
Artist 1\
album a
album b
singles
Artist 2\
singles
Artist 3\
album a
album b
album c
Code: Select all
foreach($item, listpane( ,"*.jpg", 1)) {
$name = gpc($item, "name");
if ($name != "folder.jpg") {
selectitems $item;
delete(1,0);
}
}
Code: Select all
foreach($item, listpane( ,"*.jpg", 1)) {
$parent = gpc($item, "parent");
$name = gpc($item, "name");
if ($name != "folder.jpg") && ($parent != "Singles") {
selectitems $item;
delete(1,0);
}
}
Code: Select all
foreach($item, listpane( ,"*.jpg", 1)) {
$parent = gpc($item, "parent");
$name = gpc($item, "name");
if ($name != "folder.jpg" && $parent != "Singles") {
selectitems $item;
delete(1,0);
}
}
Code: Select all
foreach($item, listpane( ,"*.jpg", 1)) {
$parent = gpc($item, "parent");
$name = gpc($item, "name");
if ($name != "folder.jpg"){
if ($parent != "Singles") {
selectitems $item;
delete(1,0);
}
}
}