Except checking whether the folder is empty or not, i would also like to know whether the *.log files are removed. Here is another example.
#!/bin/sh # Read a folder path from user input and check if # there is any .log file # Read the folder location # "\c" means keep the cursor on the same line echo "Please input the folder location: \c" read _folder # Quit if the folder does not exist if [ ! -e $_folder ]; then echo 'Sorry, folder does not exist.' exit 1 fi # Check if the folder contains any .log files if [ -z "$(find $_folder -name \*.log -print)" ]; then echo "$_folder does not have any log files" else echo "$_folder contains log files" fi