0

通常,该ls -la命令显示文件和复制访问权限、所有者和访问组。**

  • 如何仅列出我有权访问的目录/文件?
  • 如何将这些目录/文件复制到目标目录?
4

2 回答 2

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
于 2013-09-13T16:38:04.147 回答
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"
于 2013-09-25T15:13:20.000 回答