Build precise queries to find exactly what you need
Press ESC to close
If you want to do it recursive, use find to locate the indicated directory most recent file (on the tree). Then, take the file, and break the loop, indicate that the next file (the most recent unique file) is the find result file.
Here is an example code, of modificated lines, excluding *.ini, *.tm? and *.db files:
# Loop through each provided directory. for dir in $dirs do check_file= let “DIR_COUNT += 1” > /dev/null
# Check if dir exists. full_path=${base_dir}${dir}
#Agregado por Cristian Barreto full_path_archivo=`find $full_path -not -name “*.tm?” -not -name “*.ini” -not -name “*.db” $ indiceBarra=`expr match “$full_path_archivo” “.*/”` full_path=`echo $full_path_archivo | cut -c 1-$indiceBarra` #FIN del agregado if [ -d “$full_path” ]; then file_list=$full_path_archivo # Cycle through files, looking for a checkable file. for next_file in “$file_list” do next_filepath=$full_path_archivo if [ “$check_dirs” ]; then # Check if it’s a file or directory. if [ -f “$next_filepath” ] || [ -d “$next_filepath” ]; then check_file=1 fi
. . . . break #at the end of loop done
——————————–
done!, remember that $next_filepath must have “$next_filepath” and “${next_filepath}” to support file names with blank spaces like Windows file names.
Sorry for my bad english.
We’ve completely redesigned the world’s largest repository of Nagios plugins and monitoring tools. Join thousands of users sharing monitoring solutions for servers, applications, and everything in between.
Due to our redesign, all existing accounts require a password reset to access your account again.
Ready to explore 6,100+ projects and contribute to the community?
Reset Password Create Account
Happy Monitoring!