I have this simple bash script to check for ~ application/x-trash files within a directory and its subdirectories.
It works fine, but it echoes empty .~ too, which seems to be harmless but annoying. How do I avoid that?
Script
#!/bin/sh
cd '/var/www/html/mypath/'
for d in $(find '/var/www/html/mypath/' -maxdepth 6 -type d)
do
echo $d
for f in $d'/'*.*~;
do FILE=$f;
echo 'file to be removed: '$FILE
done
done
For a subdirectory dir, if there is not a ~ file into dir, at the terminal I get anyway:
file to be removed: /var/www/html/mypath/../../../dir/*.*~