Tuesday, September 13, 2016

How to count number of Files and Folders inside a given Directory

root@ashok:/opt # tree -iLf 1 puppetlabs/
puppetlabs
puppetlabs/bin
puppetlabs/facter
puppetlabs/file.txt
puppetlabs/mcollective
puppetlabs/puppet

4 directories, 1 file
root@ashok:/opt #

Tuesday, September 6, 2016

Sending HTML Mail using Mutt utility - Perl Syntax

my $current_date = `date +"%d-%b %H:%M"`;
chomp($current_date);

system("/usr/bin/mutt -e 'set content_type=text/html from=FromAddress\@domain.com realname=\"System Team\"' -s \"Report from $hstname at $current_date\" ToAddress\@domain.com -a FileName -c user1\@domain.com,user2\@domain.com < InputFile")