Hello. I do have a problem.
The statement sounds like this: Given a directory, find all subdirectories (regardless of depth) which contain a file that has more than a half of the size of the respective subdirectory.
I've tried to solve this in many ways, but all I came up with is half solutions.
One would be trying this:
where I would search for the size of each file, x being a variable, but this should be applied to each file.
Another one, which seems not to work, would be this:
but still, i should search for each file and compare it with the directory.
trying
would be a solution, but I can't connect it with another command.
or this one:
where, size($i) would be the size converted in blocks, and I didn't know how to do that.
Thanks
Last edited by WorkOfArt; 10-13-2009 at 09:23 AM..
It is great to see your question, i would greatly appreciate it.
Here is the answer for you.
So only the feed is the file whose size is 18k which is more than the half of the dir size which is 28K.
To get that, following is the script.,
If it requires a little edit for your requirement, go a head and do it. But this would help you in achieving the core part of what you would want.
OS : RHEL 6.6
I want to list the files/directories sorted (Ascending or Desceding) by their size.
As you can see in the below example, du command doesn't sort by size.
In Linux world, is there any other command or workaround using du command to list the files/directories sorted by their... (6 Replies)
Hello,
Here is my code:
:~$ truncate -s 16M MyTestFile.txt
:~$ du -h MyTestFile.txt
4,0K MyTestFile.txt
Q1: Please why du -h does not work in this case ?
Q2: Other than "du -h", how can i get the size of a directory (using linux command)
Thanks a lot.
Best Regards. (2 Replies)
I have been searching both on Unix.com and Google and have not been able to find the answer to my question. I think it is partly because I can't come up with the right search terms.
Recently, my virtual server switched storage devices and I think the problem may be related to that change.... (2 Replies)
To find the whole size of a particular directory i use "du -sk /dirname".. but after finding the direcory's size how do i make conditions like if the size of the dir is more than 1 GB i hav to delete some of the files inside the dir (0 Replies)
Hi,
We currently have an Oracle database running and it is creating lots of processes in the /proc directory that are 1000M in size. The size of the /proc directory is now reading 26T. How can this be if the root file system is only 13GB?
I have seen this before we an Oracle temp file... (6 Replies)
Good day
Probably a simple script though I am new to attempting to script. I have a directory that I would like to get the size of the files and number of files for each date
ie 14 Sep 669 files 1.8g
12 Sep 221 files 500mb
Any ideas?
Thanks (1 Reply)
Hi,
I have directories with name like:
aaa
bbb
ccc
...
I would like to to see which directories are the largest and then list the files within each. I have success using:
du -ks * | sort -rin | head -n 20
which gives me an output like:
120 bbb
27 ccc
3 aaa
...
I would like... (3 Replies)
I have two file in a Directory.I want a script which will compare the Size of Two file.
Can Anyone Help me on this:
linasplg11:/opt/dataout/kk/linasplg11 # cat size
-rwxrwxrwx 1 root root 16658 Jan 8 13:58 lina_IP_SIP_1231325621210.xml
-rwxr-xr-x 1 root root 16672 Jan 8 14:30... (1 Reply)
Hi,
I have to directory
/usr/inbound
-------------
10900.txt
10889.txt
109290202.txt
I need to create inbound directory
and i need to know size of these files one by one
if file size is zero i need to print message like "empty file"
Please help me how to solve this
thanks
krish. (1 Reply)
Hi,
I have written one script to calculate total space of all file in one directory, ignoring subdirectory, it works fine.
Now, I've been trying to calculate all files which includes files in any subdirectories.
I use recursive function to do this, but it can work only if there is only one... (4 Replies)