[Assorted-commits] SF.net SVN: assorted: [879] shell-tools/trunk/src/bash-commons/common.bash
Brought to you by:
yangzhang
From: <yan...@us...> - 2008-07-07 21:37:49
|
Revision: 879 http://assorted.svn.sourceforge.net/assorted/?rev=879&view=rev Author: yangzhang Date: 2008-07-07 14:37:58 -0700 (Mon, 07 Jul 2008) Log Message: ----------- added clear-ntfs-perms Modified Paths: -------------- shell-tools/trunk/src/bash-commons/common.bash Modified: shell-tools/trunk/src/bash-commons/common.bash =================================================================== --- shell-tools/trunk/src/bash-commons/common.bash 2008-07-07 21:37:48 UTC (rev 878) +++ shell-tools/trunk/src/bash-commons/common.bash 2008-07-07 21:37:58 UTC (rev 879) @@ -444,6 +444,21 @@ (( "$( find "$path" -perm u=rw | wc -l )" == 1 )) } +# Reading NTFS file systems (through ntfs-3g at least; don't know if this is +# inherent with NTFS in general) shows all files and directories as having +# completely set permissions (777). These stick if you move/copy the files. +# This resets the permissions. +# +# Note that this is not a panacea; there may well be files that you want to +# remain executable, or files/directories that you wish to leave +# group-/world-writeable. +clear-ntfs-perms() { + for dir in "${@:-.}" ; do + find "$dir" -type d -perm 777 -print0 | xargs -0r chmod 755 + find "$dir" -not -type d -perm 777 -print0 | xargs -0r chmod 644 + done +} + #if ! is_declared indent ; then # noindent #else This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |