Reputation: 298
The below command will show how many characters contains in every file in current directory.
find -name '*.*' |xargs wc -c
I want to write the standout into a file.
find -name '*.*' |xargs wc -c > /tmp/record.txt
It encounter an issue:
wc: .: Is a directory
How to write all the standard output into a file?
Upvotes: 0
Views: 1092
Reputation: 4004
Why -name '*.*'
? That will not find every file and will find directories. You need to use -type f
, and better than piping the result to xargs
is using -exec
:
find . -type f -maxdepth 1 -exec wc -c {} + > /tmp/record.txt
-maxdepth 1
guarantees that the search won't dive in subdirectories.
Upvotes: 1
Reputation: 339
I think you maybe meant find |xargs wc -c
?
find -name '.'
just returns .
Upvotes: 0