File Inventory Scan

Is there such a script out there that will Analyze a folder and subfolders, getting file type utilization and file aging. A CSV file will be created with file information File,Size,Date Created,Last Modified,Last Accessed,Extension,File Type,Owner
A Summary report text file will also be created with analysis by file age and file type.

I got one for my windoZe servers but would like to run something similar on my AIX and Linux boxes.

Thanks

I did a quick reformat to CSV on this - you get to play with it if it doesn't meet your needs.

#!/bin/ksh

export string=""
filetime()
{
    perl  -e '
          use POSIX qw(strftime);
          $fmt="%Y-%m-%d:%H:%M:%S ";
          @arr  = stat $ARGV[0];
          print strftime "$fmt", localtime($arr[9]); 
          print strftime "$fmt", localtime($arr[10]);
          print strftime "$fmt", localtime($arr[8]);
          print "$arr[7] $arr[4] $arr[5]\n";         
          
         ' $1
}
cd $1
cwd="$1"
print "files in $(pwd), mtime, ctime, atime, size, uid, gid, filetype"  > file.csv
find . -type f | \
while read filename
do
    export string=""
	filetime $filename | read mtime ctime atime size uid gid
	file $filename | read dummy filetype
    print "$filename, $mtime, $ctime, $atime, $size, $uid, $gid, $filetype"
done >> file.csv

I will give it a shot and see what it does.

Thanks

Ok i ran the script. It seems to hang for some reason. I take a look at the file.csv and it looks complete but the script seems to still be running.

How could i append the date & time to the file?

I would like the output to be

hostname_date.csv

Thanks!!!

I am so new at this