#!/bin/bash

if [ -z $1 ]; then echo "Need a path argument"; return; fi

echo -e "\nScanning..."

filen=filesys_$(date +%Y%m%d_%H%M%S).txt

(echo "============"
echo "DUMP /etc/passwd:"
cat /etc/passwd
echo "============"
echo "DUMP /etc/group:"
cat /etc/group
echo "============"
echo "df /"
sudo df /
echo "============") >$filen

A=$(date +%s)
sudo find $1 \
        -not -path "/proc*" \
        -not -path "/sys*" \
        -not -path "/run*" \
        -not -path "/tmp*" \
        -printf "%p %U %G %M %s\n" | sort >>$filen

echo -e "\nCompleted in" $(( $(date +%s) - $A )) "seconds"
