Create alphabetical list of multiple folders and subfolders on separate drives
Posted: 29 Mar 2026 04:15
I'm trying to make a script that will create an alphabetical list of all my movie files using just their folder names. They are stored in multiple Movies folders on separate drives, with each movie in its own folder (name and (year)) and movies belonging to a franchise are in a franchise folder (the uppercase lines in the example below). This is an example of the folder structure:
Using folderreport, I've manged to get a file that has all the movie folders in it. Obviously, writing good scripts is not my really my strength because I know it's probably not as clean as it could be but it's what I came up with. This is the code:
It works, however, each drive is listed one after the other and I can't figure out how to sort it. I would like to sort it and maintain the franchise/movies folders as they are but if it's easier, the franchise lines could be removed and just include the movie folders.
I also made a similar script using dirs:{name} instead of tree:{name} which I could sort but then the franchise folders just became part of the list. This is the code:
Any help with either script (or a completely new one) would be greatly appreciated.
Q:\Movies A Haunting in Venice (2023) A Minecraft Movie (2025) ALIEN Alien (1979) Alien 3 (1992) Alien Covenant (2017) Alien Resurrection (1997) Alien Romulus (2024) Dawn Of The Dead (2004) Dead Man's Folly (1986) DEADPOOL Deadpool (2016) Deadpool 2 (2018) Deadwood, The Movie (2019) Death Becomes Her (1992)
Using folderreport, I've manged to get a file that has all the movie folders in it. Obviously, writing good scripts is not my really my strength because I know it's probably not as clean as it could be but it's what I came up with. This is the code:
Code: Select all
$reportfile = "C:\Users\delee\MEGA\Media\_Media File Lists\All Movies.txt";
$folder1 = folderreport("tree:{name}", "r", "Q:\Movies", "r", , , 1);
$folder2 = folderreport("tree:{name}", "r", "R:\Movies", "r", , , 1);
$folder3 = folderreport("tree:{name}", "r", "Y:\Movies", "r", , , 1);
$list = "$folder1$folder2$folder3";
$search1 = "Q:\Movies<crlf>";
$replace1 = "";
$newlist1 = replace($list, $search1, $replace1);
$search2 = "R:\Movies<crlf>";
$replace2 = "";
$newlist2 = replace($newlist1, $search2, $replace2);
$search3 = "Y:\Movies<crlf>";
$replace3 = "";
$newlist3 = replace($newlist2, $search3, $replace3);
writefile($reportfile, $newlist3);I also made a similar script using dirs:{name} instead of tree:{name} which I could sort but then the franchise folders just became part of the list. This is the code:
Code: Select all
$reportfile = "C:\Users\delee\MEGA\Media\_Media File Lists\All Movies.txt";
$folder1 = folderreport("dirs:{name}", "r", "Q:\Movies", "r", , , 1);
$folder2 = folderreport("dirs:{name}", "r", "R:\Movies", "r", , , 1);
$folder3 = folderreport("dirs:{name}", "r", "Y:\Movies", "r", , , 1);
$list = "$folder1$folder2$folder3";
writefile($reportfile, formatlist("$list", "se", "<crlf>"));