通常,ls -la
命令显示文件和副本访问权限,所有者和访问组。
**
答案 0 :(得分:1)
试试这个:
a=`find $Your_Source_Path -iname "yourFolder_whose_Files_tohide" -prune -o -type f -print`
for i in $a
do
cp $Your_source $Your_Dest_Path
done
答案 1 :(得分:0)
另一个答案是仅复制具有复制访问权限的文件。首先,导航到其文件要复制的目录。另外在这里提到您想要复制的目的地路径。请尝试以下方法: -
destination_Path="/Users/Home/Desktop/test"
b=~/Desktop/copyPermission.txt
if [ ! -f $b ]
then
touch $b
fi
a=`ls -l`
e="-----w--w-"
echo "\n$a" | sed '1d' > $b
g=`pwd`
while read line
do
d=`echo "$line" | awk '{print $1}'`
if [ $e != $d ]
then
r=`echo "$line" | awk '{print $9}'`
echo "Can have copy permission $g/$r"
{
cp $g/$r "$destination_Path" && echo "copied successfully"
} || {
echo "cannot copy due to some error"
}
#else
#r=`echo "$line" | awk '{print $9}'`
#echo "Cannot have copy permission $r"
fi
done <"$b"