Checking for file Sizes


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Checking for file Sizes
# 8  
Old 10-20-2011
Already posted:

Code:
[ -s /tmp/$$ ] && sendmail username@host < /tmp/$$
rm -f /tmp/$$

Try it.
# 9  
Old 10-20-2011
get this error


./checkforsize.sh[6]: sendmail: not found
# 10  
Old 10-20-2011
You don't have any mail-transport agent(MTA) installed.

As a guess, I'm betting you don't want to set up an entire mail server.

Depending on what your system is, you may be able to install ssmtp, a barebones pretend-MTA which just routes everything directly through an external SMTP email account.
# 11  
Old 10-20-2011
[ -s /tmp/$$ ] |mailx -r username@host -s "empty files" myemailid

i got an email...but it dint list any files

---------- Post updated at 03:34 PM ---------- Previous update was at 03:26 PM ----------

got it...

cat /tmp/$$ |mailx -r username@host -s "empty files" myemailid

this worked
# 12  
Old 10-20-2011
That's a useless use of cat.

Code:
mailx -r username@host -s "empty files" myemailid < /tmp/$$

# 13  
Old 10-20-2011
Thankssssss a lot....U r the man Corona688
# 14  
Old 10-20-2011
The [ -s /tmp/$$ ] is to make sure the file's not empty. Otherwise, it will be sent each time.

|| is not the same as | .
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Comparing file sizes

Hello, I need to compare the size of a file to what it's size was 20min ago. So far my outline script is:ls -ls /home > filesizeafter.txt compare filesizeafter.txt filesizebefore.txt > filesizechange.txt if /home filesizechange.txt > 100 { email root; } ls -ls /home >... (2 Replies)
Discussion started by: chyurdan
2 Replies

2. UNIX Desktop Questions & Answers

Summing file sizes

I was just curious about how to sum the total file size of a certain type of file. For instance: $find . -name "*.aif" will print out the paths to each .aif file. Instead of printing, how could one sum the total space used by all of the aif files? Thanks! Please use code tags (3 Replies)
Discussion started by: Alexander4444
3 Replies

3. Shell Programming and Scripting

Add all file sizes in ls -l

solaris 10 (c shell) need a command or script that will add up all (*.tmp) file sizes in bytes of a single directory, or kbytes, no matter (1 Reply)
Discussion started by: ajp7701
1 Replies

4. Programming

Checking columns in SQL, comparing user input and sizes.

I'm writing a KSH shell script that's using SQL though DB2. If I have a table defined and populated db2 "create table tb(num int,letter char(4))" db2 "insert into tb values(111,a) db2 "insert into tb values(112,b) db2 "insert into tb values(111,c) How can I check if a letter user... (0 Replies)
Discussion started by: busdude
0 Replies

5. Shell Programming and Scripting

Help with file sizes

I have 2 big files in the size of gb. They are same with respect to content, both are “,” delimited. Now both of them are created by two different processes but has the same logic. The problem is they are differing only in few bytes for e.g one file is 202195751 bytes other is 202195773. So... (2 Replies)
Discussion started by: dsravan
2 Replies

6. UNIX for Dummies Questions & Answers

Checking file sizes in script

Hi, I'm trying to check a filesize within a script and then excute a relevant action. An example is below: if then rm $filename rm $filename2 elif then rm $filename2 fi Basically if $filename2 has a filesize of 0 then I want both files to be removed, but... (6 Replies)
Discussion started by: chris01010
6 Replies

7. UNIX for Dummies Questions & Answers

File sizes -- why do they change?

I just noticed that the copy of a file I made is smaller than the original, although I hardly made any changes to it. Can anyone tell me what determines the size of files? They're all .doc files (saved in NeoOffice). It's really frustrating, because I'm using them to respond to job ads and the... (1 Reply)
Discussion started by: Straitsfan
1 Replies

8. Shell Programming and Scripting

how to compare file sizes

hi ls -l * | sed 's/\+/ /g' | cut -f5 -d " " >out1 ls -l * | sed 's/\+/ /g' | cut -f5 -d " " >out2 diff out1 out2 i tried this it will work fine and i can see difference but i need a script which should neglect, if the difference b/w files is small and it should display... (5 Replies)
Discussion started by: revenna
5 Replies

9. Shell Programming and Scripting

Script for checking and reporting file sizes in a directory.

Hi, Need help for a Script for checking and reporting database file sizes in a directory. Request you to please give your valuable inputs. Thanks a lot in advance. Best Regards, Marconi (1 Reply)
Discussion started by: marconi
1 Replies

10. UNIX for Dummies Questions & Answers

Help on adding file sizes

Hi I need to take a list of files that are defined by an ls -ltr or grep for particular file names - and add up the byte size colum which is field 5 seperated by a space. I tried to do this but I think I am way off: for file in 'ls -ltr | grep 20070916 | nawk -F" " '{temp+=5} END {print... (1 Reply)
Discussion started by: llsmr777
1 Replies
Login or Register to Ask a Question