1

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.

  1. find "$PWD" -type f ! -iname '*thumbs.db*' -print0 | xargs -0 stat -c "%y %s %n"

  2. find "$PWD" -type f -print0 | xargs -0 sha1sum -b

2 Answers 2

1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

it's works, but didn't put the result together as list sheet.
0

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 {} \;

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.