I am trying to compare a given file and compare it to a directory's files to see if any of the files within the directory are newer than the file given. I want to go through all files in the given directory including hidden files. I cannot figure out how.
I've tried changing "direct"/; to "direct"/. but it will only include the hidden files then but not all of the other files that are within the given directory.
inputfile=$1
direct=$2
for file in "$direct"/*; do
if [[ $file -nt $inputfile ]]
then
echo $(stat $file | grep Modify | cut -d' ' -f2,3) #formatting
fi
done
Aucun commentaire:
Enregistrer un commentaire