I’ve found the following line of code in a script. Could someone explain me what does this following line of code means?
Basically, the purpose of this line is find a set of files to archive. Since I am not familiar with bash scripts, it is difficult for me to understand this line of code.
_filelist=`cd ${_path}; find . -type f -mtime ${ARCHIVE_DELAY} -name "${_filename}" -not -name "${_ignore_filename}" -not -name "${_ignore_filename2}"`
Let’s break it down:
cd ${_path}: changes to the directory stored in the${_path}variablefindis used to find files based on the following criteria:.: look in the current directory and recurse through allsub-directories
-type f: look for regular files only (not directories)-mtime ${ARCHIVE_DELAY}: look for files last modified${ARCHIVE_DELAY}*24hours ago-name "${_filename}": look for files which have name matching${_filename}-not -name "${_ignore_filename}": do not find files which havename matching
${_ignore_filename}-not -name "${_ignore_filename2}": do not find files which havename matching
${_ignore_filename2}All the files found are stored in a variable called
_filelist.