I am writing a shell script that takes file paths as input.
For this reason, I need to generate recursive file listings with full paths. For example, the file
Recursive files can be listed by many ways in linus. Here i am sharing one liner script to clear all logs of files(only files) from /var/log/ directory and second check recently which logs file has made an entry.
First:-
find /var/log/ -type f #listing file recursively
Second:-
for i in $(find $PWD -type f) ; do cat /dev/null > "$i" ; done #empty files recursively
Third use:-
ls -ltr $(find /var/log/ -type f ) # listing file used in recent
note: for directory location you can also pass $PWD instead of /var/log.