![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Transfer files wih directory structure. | uxlunatick | SCO | 11 | 04-28-2008 03:25 PM |
| copy files with directory structure | adddy | UNIX for Dummies Questions & Answers | 3 | 12-11-2006 08:50 AM |
| MV files from one directory structure(multiple level) to other directory structure | srmadab | UNIX for Advanced & Expert Users | 4 | 09-13-2006 04:01 PM |
| How do I increase disk space available to a directory? | rhack | UNIX for Dummies Questions & Answers | 2 | 10-21-2005 11:54 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
disk space used for files with in a directory structure.
Hello,
I am new to shell scripting and would really appreciate if someone could help me with this question. I have a directory structure as follows.. main directory is DATA under which i have different directories names fileserver01, fileserver02 ... till fileserver 15. under each of these there are more subdirectories named 123456, 123567,123984..... 234859,234503.. etc. under each of these six digit subdirectory there are more subdirectories named subdir1, subdir2, subdir3... subdir7, which in turn contains individual files. Now, my question is.. how can I find the disk space used by certain amount of files(not starting with "deleted") under subdir1,subdir3 and subdir4. also, the disk space should be based on the first three digits of the directories starting with eg..123, 234 etc. ie. I need to find the diskspace of DATA/iterate thro' all fileservers/grouped under the matching first three digits eg 123*)/specified directories eg.subdir1,subdir3,subdir4)/(files not starting with "deleted"). I hope my question is clear. I am using Ksh. Thanks in advace. |
|
||||
|
Sorry for the confusion which I created. I have two more twists to Perderabo's solution
Under each 123* directory.. there are more subdirectories out of which I do not pick two particular subdirectories named subdir2 and subdir5. From the remaining subdirectories, I pick only those files whose names do not start with "deleted". |
|
|||||
|
If subdir2 and/or subdir5 are very large or if there are a lot of delete* files, this will slow down as it does work which is discarded by the grep processes. A complex find statement can produce a list of only the desired files...
find 123* \( -name subdir2 -o -name subdir5 -prune \) -o -type f ! -name delet\* |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|