logical AND within IF statement to search for file ext(tilde ~)
Please find the below script :
#!/bin/bash
for index in `ls -1 /appdata/frozen_files`
do
for bucket in `find /appdata/frozen_files/$index -name "*.gpg~" | cut -d/ -f4-5`
do
for files in `ls /appdata/frozen_files/$bucket/rawdata | wc -l`
do
if [[ ` "$files" -eq 1 && "file extension = .gpg~" ` ]];
then
echo $bucket >> /tmp/NAS_buckets_with_less_than_2_files.txt
fi
done
done
done
intend : i am trying to find the file extension=.gpg~ ending with tilde(~). file name example= journal.gz.gpg~.. .gpg~ files are available on /appdata/frozen_files/$bucket/rawdata | wc -l
can we create a variable that contains the extension of the file, looking at the system has something to compare it to.
"something" that can check the file extension (.gpg~)
|