Sunday, April 10, 2022

[SOLVED] How to run command on subfolder of wildcard folders?

Issue

Say I have this structure:

Some Folder 1/...
Some Folder 2/...
Adobe After Effects 2020/Scripts/
Adobe After Effects 2020/foo/
Adobe After Effects 2020/bar/
Adobe After Effects 2021/Scripts/
Adobe After Effects 2021/etc/
Adobe After Effects 2022/Scripts/
Another Folder/...

I want to change permissions on all the Scripts subfolders. I tried:

chmod -R o+rw 'Adobe After Effects */Scripts'

But that doesn't work. Any way to accomplish this using wildcards?


Solution

Wildcards are not expanded inside quotes, but you should be able to use this. Note that the * is now outside the quotes.

chmod -R o+rw 'Adobe After Effects '*'/Scripts'

That will make the specified change on all files and directories with the 'Adobe After Effects' start and the Scripts subdirectory. I'm not sure that o+rw is a good choice of permission, but you can fix that to suit yourself. I'd be more likely to use o+r,o-w.



Answered By - Jonathan Leffler
Answer Checked By - Katrina (WPSolving Volunteer)