So I try to intergrate a Button on my Toolbar to take Ownership of selected files and folders.
I tried several scripts e.g. {sourcepath$} in place of {filepath$}, but the following Button works so far the best.
Unfortunately this works only with files not folders too.
I'm not 100% sure how takeown and icacls work as I've only used them in passing, but from looking at their command-line help and the arguments you are passing to them:
You're passing the /r argument to takeown; that tells it to "operate on files in [the] specified directory and all subdirectories."
You're passing the /t argument to icacls; that tells it to operate "on all matching files/directories below the directories specified."
So I'm guessing that either or both of the tools expects a directory when run in that way and will ignore any filenames passed to it.
The Problem is not so much in the takeown or icacls commands, I have modified them accordingly.
I need one single Opus control sequence for passing both file and folder paths to takeown respectively icacls.
And how I tell Opus to use one takeown/icacls argument set for files and another argument set for folders and if posible in one single button.