I would like to make a PowerShell script trigger other scripts based on the existence of *.mp4
files in subfolders of a parent folder.
The question is the following: I have a folder called "Cut" inside that folder I have other folders that follow the logic Model 01
, Model 02
, Model 03
...
Inside each Model XX
folder I have a .ps1
script that I would like to be triggered every time there is a .mp4
file inside it.
The main point is that this script would have to be called in a new instance, not inside the main script.
What's the best way to do this?
What I've come up with so far is this:
Get-ChildItem -Path "$env:USERPROFILE\Desktop\Cut" -Recurse -Filter "*.mp4" -ea 0 | ForEach-Object {
Start-Process powershell ".\ffmpeg.ps1"
}