Files
zurg/scan_test.sh
Ben Sarmiento c8334ecb3b Hotfix
2023-11-27 21:50:00 +01:00

24 lines
472 B
Bash
Executable File

#!/bin/bash
process_file() {
echo "Processing $1"
# echo -n "First 100 bytes of $file: "
# | od -An -t x1
# dd bs=1 count=100 if="$file" 2>/dev/null
dd bs=1 count=100 if="$1" >/dev/null 2>&1
}
export -f process_file
if [ "$#" -ne 1 ]; then
echo "Usage: $0 directory"
exit 1
fi
if [ ! -d "$1" ]; then
echo "Directory $1 does not exist."
exit 1
fi
find "$1" -type f -print0 | xargs -0 -n1 -P20 -I{} bash -c 'process_file "$@"' _ {}