Gungelalex 1 Posted February 4, 2023 Share Posted February 4, 2023 I have a niche problem that I created a [not-perfect] solution for. I want to create stub files for my media that I don't have converted from physical media yet. When I do have those movies converted, there are already folders to put them in, but creating the folders and the files by hand is tedious. In response to this dilemma, I created a script (having never really using PowerShell and through about 3 hours of research, trial and error) that would help me make these properly formatted stub files faster. do { #Have user type in the Movie name and year using Emby Format; $proc = Read-Host -Prompt 'Input Movie Name and Year as `"NameOfFilm (YYYY)`". Otherwise, type `"done`"'; #If user types "done", the script will exit the loop and exit the terminal; If($proc -eq 'done') {break}; #Ask user for the movies' media type; $form = Read-Host -Prompt 'Input Movie Format (bluray, dvd, vhs)'; #Sets "$file" variable using user prompted variables "$proc" and "$form"; $file = "$proc\$proc.$form.disc"; #Creates movie folder first, and then creates the file; New-Item $proc -type Directory | Out-Null; New-Item $file -type File -Value $proc | Out-Null; #shows that script has recorded file in the terminal; Write-Host "Recorded $file"; #tests "$proc" variable: continues loop if not equal to "done"; }while ($proc -ne 'done') At the moment, it is a user prompted script, so there is still some tedium, but it isn't as bad as it used to be. I have the script stored in the library location for my Movies, and run it when I want to add a new stub. Once done, you can simply type "done" during the movie name prompt to close the script. With finessing, it could be reworked to use a spreadsheet as the source of the info, and I eventually want to do that (I'll need to learn more PowerShell scripting). Posting this for anyone else who might have this problem and need a solution, or for anyone who wants to contribute. V2: New-Item Output is silenced through Out-Null, to cleanup the terminal during use. stubMaker_v2.ps1 stubMaker_v1.ps1 1 Link to comment Share on other sites More sharing options...
Luke 37112 Posted February 21, 2023 Share Posted February 21, 2023 Thanks for sharing. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now