Reputation: 107
OS: Linux RedHat
Bash: 3.5
I have 2 commands below to get list of files with status of them and another command for footprint. I want to find the way to combine them together in single line.
Here's my mentioned commands.
find "$PWD" -type f ! -iname '*thumbs.db*' -print0 | xargs -0 stat -c "%y %s %n"
find "$PWD" -type f -print0 | xargs -0 sha1sum -b
Upvotes: 1
Views: 79
Reputation: 490
You can do this with -exec in find command itself.
find $PWD -type f ! -iname '*thumbs.db*' -exec stat -c "%y %s %n" {} \; -exec sha1sum -b {} \;
Upvotes: 0
Reputation: 52433
Will this work? Do a man
on xargs
.
find $PWD -type f ! -iname '*thumbs.db*' -print0 | xargs -0 -I '{}' sh -c 'stat --printf "%y %s %n " {} ; sha1sum -b {}'
If you do not want the file name repeated twice:
find $PWD -type f ! -iname '*thumbs.db*' -print0 | xargs -0 -I '{}' sh -c 'stat --printf "%y %s %n " {} ; sha1sum -b {} | cut -d\ -f1'
There needs to be 2 blank spaces after d\
in cut
command.
Upvotes: 1