1
To check a successfull migration I'm using find
to count the number of files, directories, symbolic links and files with more than one hard link. As the directories to check contain a huge number of files, each find
run takes several hours. Thus I search for a way to separately count number of files, directories, symbolic links and files with more than one hard link within a single find
run.
Here's what I currently do
num_files=$(find $directory -type f | wc -l)
num_directories=$(find $directory -type d | wc -l)
num_symlinks=$(find $directory -type l | wc -l)
num_hardlinks=$(find $directory -type f -links +1 | wc -l)
How can I get those four counters within one find
run?
I'm not sure this is the best approach to comparing two directories. Are you sure this is what you should be asking? – Daniel Beck – 2013-07-24T07:28:10.603
The best way to compare two directories is probably a dry run of
rsync
. But I need to proof that rsync copied all files, directories, symbolic links and hard links and I don't know a better way than doing it withfind
. – Florian Feldhaus – 2013-07-24T07:33:17.247