Changing RWX permissions recursively?

Support for Android version of Total Commander

Moderators: white, Hacker, petermad, Stefan2

Post Reply
mrle
Junior Member
Junior Member
Posts: 58
Joined: 2005-04-25, 21:44 UTC

Changing RWX permissions recursively?

Post by *mrle »

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?
Cvulturbo
Junior Member
Junior Member
Posts: 30
Joined: 2013-02-09, 14:25 UTC
Location: eu ru

Post by *Cvulturbo »

How, if it is at all possible, to make a button that will send the shell command for changing folder permissions (attributes) recursively?
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.

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
this button execute script /sdcard/chmod.sh:

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"
this script change permissions of selected dir or single file to o+rw, if directory selected and this dir already have o+rw mode, it chmods o+rw recursively in selected dir. if your android does not have root access and busybox installed, you need to write a little bit simpler script for you.
mrle
Junior Member
Junior Member
Posts: 58
Joined: 2005-04-25, 21:44 UTC

Post by *mrle »

Thank you Cvulturbo. It is not working here, says something like ...

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 {} + 
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.
User avatar
sitte
New Member
New Member
Posts: 1
Joined: 2017-07-26, 17:07 UTC
Location: Lublin, poland

Post by *sitte »

Can somebody post print screen how to set it up?
I'm getting "file not found".

Mannualy I search all files, show files in panel, I select dirs and change chmod, then I do it again with files.
Post Reply