Programming :: Write A Script That Will Calculate A Directory Size?

Jan 20, 2009

I'm trying to write a script that will calculate a directory size and if the size is greater than 4GB, it will send out an email. But I am getting the "integer operation expected" error when it tries to calculate the current disk size. Here's my script.

Code:

TO="user@email.com"
SUBJ="Ready for DVD burning on `hostname`"
MAIL="/bin/mail"

[code]....

View 1 Replies


ADVERTISEMENT

Ubuntu :: Calculate Size Of Tmp Directory In All Acconuts?

Nov 11, 2010

How can I calc the size of the tmp directory in all account. Do the following will calc each dir alone code...

View 1 Replies View Related

Programming :: Write A Script To Calculate The Total Amount Of Installed Memory?

Apr 4, 2011

I am trying to write a script to calculate the total amount of installed memory to use during an anaconda kickscript, so the swap file is created at 2 x the installed memory. I so far have the amount of installed RAM DIMMS but need a way to total them up and produce a varible I can use in the pre section of the install.

Code:

dmidecode -t 17 | grep Size | awk ' { print $2 }'
Output:
2048
2048

Note: on some servers there could be from 1 DIMM up to 16 DIMMS installed so the script needs to be able to handle this. I also can not use bc as it does not exist during the install stage. I am guessing I need a while loop to do this and use expr but do not know where to start for this logic.

View 3 Replies View Related

Programming :: Write A Script That Will Go Through The Files In A Directory?

Nov 19, 2008

How can I write a script that will go through the files in a directory and print on the screen the name of the files stating if it is a file or directory. The directory is already provided by the user.

View 12 Replies View Related

General :: Calculate Minimum Ext3 Partition Size For Certain Amount Of Data?

Aug 5, 2011

These following ext3 partitions contain identical data. As we can see, the larger the partition size, the more space is required for the same files:

Filesystem 1K-blocks Used Available Use% Mounted on
/dev/loop11 3965777 561064 3199964 15% [...]
/dev/loop19 573029 543843 29186 95% [...]

[code]....

View 2 Replies View Related

Programming :: How To Write Script That Would Use Join Across All Files In Directory?

Aug 19, 2010

I have a bunch of files that contain a date, then data. When I use join, I get exactly the output I need. But manually joining the first with the second, then that output with the third and so on would take days. I have thousands of files. Can any of you folks help me write a script that would do this?To put it another way, for clarity's sake, here is what I am currently doing

If I were to repeat that 3000 times the final output would be what I need. I know a simple script would do this for me, but I can't figure out how to write it.

View 12 Replies View Related

Programming :: Write A Bash Script That Continue Monitor The Tmp Directory?

Dec 25, 2010

In my tmp directory some logs are creating continue (with name logs.txt1, logs.txt2 up to 245). Some times these logs are creating continue within 1 or 3 second gap, now I want to write a bash script that continue monitor the tmp directory and if any time logs create simultaneously within 1 or 3 section gap it will alert me..( generally logs are create with the gap of 5 or 10 minutes duration or some time after one hours )

View 1 Replies View Related

Programming :: Write A Script That Will Detect All The Unwanted Files In A Particular Directory

Apr 1, 2011

I want to write a script that will detect all the unwanted files in a particular directory and delete them in one fly..

View 11 Replies View Related

Programming :: Calculate Length Of My Array?

Jun 30, 2010

I want to calculate length of my array, say Unix here.

Code:
[linux1@HMLINUX1 abc]$ declare -a Unix=('Debian' 'Red Hat' 'Suse' 'Fedora');
[linux1@HMLINUX1 abc]$
[linux1@HMLINUX1 abc]$ echo ${#Unix[@]}
5

This should be ideally 4, but somehow it is showing as 5. However, when I am removing the space as RedHat instead of Red Hat, it is working perfectly.

Code:
[linux1@HMLINUX1 abc]$ declare -a Unix=('Debian' 'Redhat' 'Suse' 'Fedora');
[linux1@HMLINUX1 abc]$ echo ${#names[@]}
4

View 4 Replies View Related

Programming :: Calculate Data And Make It Into New Column Using Awk?

May 24, 2011

i've been using a awk script to calculate my data... i have 3 files:

file a1.txt:

2
3
4

[code]....

the results were (3.5, 6 and 3) which is pretty easy.. now i want to combine all this into 1 file and each have different columns and called it avg.txt which have something like this in the end:

3.5 6 3

View 1 Replies View Related

Programming :: Bash Calculate The Repeated Lines?

Jan 28, 2010

i have a sorted file with many repeated lines like this:

1ujw
1ujw
1ul1
1us7

[code].....

i need to calculated haw many times each line is repeated, for ex

1ujw 2
1ul1 1
1us7 5
etc.

View 5 Replies View Related

Programming :: Calculate Logarithm In Bash Script?

Dec 12, 2008

I want to calculate log in bash script. I searched but could not find any bash command to directly do it. I am also thinking to send the variable in C program, calculate in C and get the answer back in bash script.But I think it is a long process. as I have to do this

i) gcc -o log log.c

ii) ./log > log_result.txt

iii) then read the result from log_result.txt

View 5 Replies View Related

Programming :: Clock() - Calculate How Much Time Does My Program Run?

May 11, 2011

im trying to calculate how much time does my program run, use very simple script

clock_t end, start;
start= clock();
int i;
printf("initial %d
",(int)start);
[Code]....

but it outputs 0 all the time. cant figure out where could be the problem.

View 2 Replies View Related

Programming :: Calculate The Time Taken For A Sample Program To Run?

Apr 24, 2011

i have the example code below, i want to calculate the time taken for a sample program to run. but i keep getting undefined reference error.

#include <sys/time.h>
#include <iostream>
int main(int argc, char **argv) {
struct timeval startTime;
struct timeval endTime;

[Code]...

View 9 Replies View Related

Programming :: Calculate The Amount Of Data Had Been Download?

May 3, 2011

i'm trying to write a program with c socket programming,what i am trying to reach is a program which will calculate a computer's downloaded data from the internet,just to know how much he/she download?

View 1 Replies View Related

Programming :: Calculate The Number Of - Necessary - Bits In A Byte ?

Jun 11, 2010

E.g. 98 is represented as 1100010 (number of valid bits is 7)

What is the formula to calculate the number of valid bits in a byte ?

View 14 Replies View Related

Programming :: Calculate How Many Nanosecond The Process Takes

Apr 10, 2011

ı need to calculate how many nanosecond the process takes . must give the same value every time (c++) ubuntu 10.10 my system information:

*-cpu
description: CPU
product: Intel(R) Core(TM)2 Duo CPU T7300 @ 2.00GHz
vendor: Intel Corp.
physical id: 400

[code]...

View 6 Replies View Related

Programming :: Calculate The Blade Offset In Python?

Dec 30, 2010

I'm using pyqt3 for my app and am lost on even how to attempt this task... On a vinyl cutter to have the blade pivot it must be offset from the center of the shaft it's on so say for example a .25mm offset would leave a .25mm unwanted vinyl attachment when the cutting is done. I somehow have to average or extrapolate that .25mm xy coordinate and add it to the hpgl plot file as a PUx,y; command? I have enclosed a simple sample file that has three images in it. In the corresponding hpgl file everything between the PU commands that are starting with PD are the code for that image (star for eg the pu to move to next image and then all PD for the next image and so on, so once the formula or procedure is figured out it can be applied to as many images there are in the file. Placing the new command at the head of each image PD group. Since there are absolute and relative cutters I enclosed the same exact plot for both types as the coordinates on relative can be negative numbers. Only PU and PD commands and a ";" as a command delimiter as sometimes many commands are on one line.The offset variable will come from a spinbox but .25 is good for an example.

View 14 Replies View Related

Programming :: Sudoku - Calculate The Correct Box For A Given Square?

Apr 8, 2011

Im doing a sudoku-solver as a school assigment in Java. It is supposed to solve both 6x6, 9x9 and 12x12 boards.Im pretty much done with my algorithm(brute force), but I'm having a hard time figuring out how to calculate the right Box for a Square. I found this snippet:

Code:

// calculate BoardPos for index, where index is 0..80
void loadBoardPosFromIndex(BoardPos &pos, int index) {
pos.index = index;

[code]...

This works on 9x9 boards, but I really dont get the math behind this, and how I can create a generic rule for both 6x6, 9x9 and 12x12 boards.

View 4 Replies View Related

Programming :: Awk - Calculate The Number Of Words Containing Letter E In A Textfile?

Oct 12, 2010

i need to calculate the number of words containing letter e in a textfile.

View 9 Replies View Related

Programming :: Calculate Flash Memory End Address Of A Certain File?

Mar 9, 2011

how to calculate (if possible) the end address of an image file in a flash memory. I'm trying to create a checksum and checkheader function and the info that I got is the file's offset, how many sector it consumes and its size. I kinda need the end address, sad thing is, I don't know how to calculate it.test.img's start address is 0, the size is 0x20000 and consumes 3 sectors.

View 6 Replies View Related

Server :: Can't Write Files To A Sub-directory Of The Chroot Directory

Jul 20, 2011

I'm using OpenSSH 5.5p1 on Fedora 15. I'm trying to get a chrootDirectory to work. Specifically trying to figure out why I can't write files to a sub-directory of the chroot directory. I created a user test_user and created a group called sftp. I added test_user to the sftp group. I edited /etc/ssh/sshd_config as follows:

Code:

Subsystem sftp internal-sftp
Match group sftp
ChrootDirectory /home/sftp_users/%u
X11Forwarding no

[code]....

View 1 Replies View Related

Programming :: Calculate The Minutes Difference Between Two Dates Using The Function Mktime() On C++?

Jul 28, 2010

I'm trying to calculate the minutes difference between two dates using the function mktime() on c++. The dates will be passed to me as struct tm, and I will use this function many many times. The example below shows what I wanna do:

Code:

int main(int argc, char** argv) {
while (1) {
tm date2;
tm date1;

[code]...

I read the mktime() description on c++ reference, searched google... but there is no light

View 4 Replies View Related

General :: Write A Script To Compress Any File With 10 MB Size To Tar.gz?

Jun 7, 2010

write a script to compress any file with 10 MB size to tar.gz

Say /var/log/tes directory has a file with 10 MB I want it to compress to tar.gz

View 2 Replies View Related

General :: Cannot Read / Write SD Card After Improper Format (sector Size 0) - Fix It?

Jun 12, 2011

I was attempting to reformat a 16GB MicroSD card in my camera when the battery died mid-way. After that, any time I try to read the card in my camera, it gives me a "Card Error" and does not allow me to reformat it in my camera.

So, I thought I would plug the camera in to the laptop with it set to host the card as media when plugged in as USB, in an attempt to fix the formatting issue.

However, when I plug it in to my linux machine, it does not register as a device (e.g., /dev/sda) due to some errors, therefore I cannot reformat it. Essentially, I think I need to fix the partition table but I'm not sure how to when it doesn't register as a device. code...

View 7 Replies View Related

Ubuntu :: Limit Directory Size \ Set A Size Limit On?

Mar 2, 2011

I have 2 directories in my home folder that I would like to set a size limit on. The directories are ~/backup and ~/temp. Is there an easy way to limit the size of a directory without having to make partitions?

View 4 Replies View Related

General :: How To Set Directory Size

Jun 14, 2011

I need to set size limit for shared directory. Actually i am unable to set directory size for my NFS shared foldermy Dir locate in /root/ESSR_logex : This ESSR_log Directory size should be 20GB. that mean NFS client only can store up to 20 GB files. NOT MORE

View 4 Replies View Related

Ubuntu :: How To Know Directory Size In Terminal

Jan 4, 2011

Is there any way we could display dicrectory's size in terminal? Because I need to copy directories to external devices like USB, so I need to know there is enough space left on my USB for those directories or not. I tried ls command but still couldn't find out.

View 2 Replies View Related

General :: Adjusting The Size Of A Directory?

Sep 28, 2010

I have a 4gb USB thumb drive with Ubantu 9 on it and it looks like I have over 3gb free but I only have 4mb free in the documents Directory. w do I increase the size of the directory so I can add my Doc files?

View 3 Replies View Related

General :: How To Restrict Directory Size

Aug 5, 2011

As example, I have directory in /root called as "shared". i already shared this directory using NFS. i want to limit this directory size into 20 GB(20*1024*1024).That means "shared" directory reserved 20 GB disk space from the HDD.how can i solve this problem

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved