Edit File: get_top_files.sh
#!/bin/bash # Run dependency scripts sh /usr/local/cptools/get_reseller_emails.sh sh /usr/local/cptools/get_reseller_accounts.sh sh /usr/local/cptools/fetch_top_files.sh # Output file where results will be saved OUTPUT_FILE="/usr/local/cptools/textfiles/top_100_files.txt" rm -f $OUTPUT_FILE # Command to find top 100 largest files (including .tar.gz) in all home directories find /home*/ -type f ! -path "*/virtfs/*" -exec du -h {} + 2>/dev/null | sort -hr | head -100 | \ while read -r size path; do echo "$path ---- $size" >> "$OUTPUT_FILE" done echo "Top 100 files with their sizes have been saved to $OUTPUT_FILE"