How, if it is at all possible, to make a button that will send the shell command for changing folder permissions (attributes) recursively?
Or in other words ... how to change RWX permissions for ticked folder(s) and all subfolders inside it/them with TC?
Does anyone here know these Linux commands and whether it is possible to make a button on TC button bar with that command?
Changing RWX permissions recursively?
Moderators: Hacker, petermad, Stefan2, white
button will not ask you for desired mode. button can send only static mode. but you can write smart script for your quest and call it by button.How, if it is at all possible, to make a button that will send the shell command for changing folder permissions (attributes) recursively?
edit:
for my purpose i am using button:
Code: Select all
Function type:
Send shell command
Command:
su
Parameters:
sh /sdcard/chmod.sh %P%N
Code: Select all
#!/system/bin/sh
# chmod recursive in dir
if [ -d "$*" ] ; then
line=`stat "$*" --print=%A`
if [ ${line:7} = "rwx" ] ; then
find "$*" -exec sh -c 'chmod o+rw "{}" ; chmod o+X "{}"' \;
echo "Mode changed recursively"
exit
fi
fi
# chmod single dir
if [ -d "$*" ] ; then
chmod o+rwx "$*"
m=`stat "$*" --print=%a`
echo "Mode changed: $m"
exit
fi
# chmod single file
chmod o+rw "$*"
m=`stat "$*" --print=%a`
echo "Mode changed: $m"
Thank you Cvulturbo. It is not working here, says something like ...
But in the meantime I finally found a command that works for me, directly from TC button ...
It is recursively change folders permissions (also for folder/subfolders with spaces in names), while for files inside does not change anything.
---
2ghisler(Author)
It would be great if TC had a built-in commands for changing permissions recursively, such as having for change the date/time.
Root Explorer has some.
Code: Select all
Bla-bla ...
/path/to/chmod.sh[11]:[:
rwx: unexpected operator/operand
Bad mode
stat: unrecognized option `--print=%A´
BusyBox v1.21.0-jb bionic ... bla-bla ...
... bla ... bla.
But in the meantime I finally found a command that works for me, directly from TC button ...
Code: Select all
Function type:
Send shell command
Command:
su
Parameters:
find %P%N -type d -exec chmod 775 {} +
---
2ghisler(Author)
It would be great if TC had a built-in commands for changing permissions recursively, such as having for change the date/time.
Root Explorer has some.