Reputation: 122012
Normally, the ls -la
command shows the files and the copy access rights, owners and access group.
**
Upvotes: 0
Views: 306
Reputation: 14995
One more answer which will copy only those files whose having copy access permission. For this first navigate to the directory whose file wanted to copy. Also inside this mention your destination path first where you wanted to copy. Try the below:-
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"
Upvotes: 0
Reputation: 14995
Try this:
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
Upvotes: 1