#!/bin/bash mock_scanner() { echo "Processing $1..." dd bs=1 count=100 if="$1" >/dev/null 2>&1 echo "Processed $1" } export -f mock_scanner 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 'mock_scanner "$@"' _ {}