Monday, 22 October 2012

File check up code

#!/bin/bash
ls -ltr | awk '{print $NF}' | while read a
do
if [ -f $a ]
then
echo $a >> /tmp/file
elif [ -d $a ]
then
echo $a >> /tmp/directory
else
echo "this is not a file"
fi
done

No comments:

Post a Comment