I am attempting to create a simple PowerShell script, but keep getting an error on this line: Get-ChildItem -Path $dir -Exclude $exts -Recurse | Where-Object { ! $_.PSIsContainer } | Remove-Item -Recurse -Verbose
I’ve tried escaping the curly brackets, but that doesn’t seem to work. What am I missing?
The curly-bracket escaping can be confusing, as to where escaping is needed. Have a read-through of the tip at Tip: Escaping curly brackets for substitutions in ActionScript and if that doesn’t help, please post the actionscript with the escaping here.
It would seem that escaping the first set of curly braces should fix the issue, but when debugging the actionscript in the debugger, I keep getting an error. The issue seems to be with the nested if statements in the PowerShell script:
I’m glad you got it working, but I still think we should have been able to create the PS script on the fly; I’m doing that in a number of my actions already. If you aren’t too frustrated with it already I’d like to see the actionscript version that failed.
Your first post had none of the { symbols escaped as {{, your next post had only the first one escaped…can you post one with all the escapes…
NEVERMIND there’s also a totally different issue I see.
The createfile until end is too generic. It looks for the token ‘end’ anywhere. ‘end’ doesn’t have to be on its own line to match, and it doesn’t even have to match a whole word.
The ‘end’ in ‘Append’ here would match and try to close the ‘createfile’ statement. Try using something that won’t appear in the powershell script - I usually do something like ‘createfile until EOF_EOF’
Hi Jason,
That did it. I didn’t realize that the createfile until looks for just that word. Makes sense though.
I also didn’t realize that it doesn’t help to paste just the createfile section into the debugger. I tried that with the changes initially, and it was still giving me errors (in the debugger). As soon as I pasted the entire actionscript into the debugger, it passed with flying colors.