Sponsored Content
Top Forums Shell Programming and Scripting disk space used for files with in a directory structure. Post 60300 by kasala on Friday 14th of January 2005 11:32:38 AM
Old 01-14-2005
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.
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How do I increase disk space available to a directory?

I know very basic Unix commands s I would really appreacite the assistance of a Unix guru. I am installing an application on a Sun server, when attempting to install I get an error that says I do not have enough sapce allocated for my install directory. Error says it has 7235m but needs 15360m.... (2 Replies)
Discussion started by: rhack
2 Replies

2. UNIX for Advanced & Expert Users

MV files from one directory structure(multiple level) to other directory structure

Hi, I am trying to write a script that will move all the files from source directory structure(multiple levels might exist) to destination directory structure. If a sub folder is source doesnot exist in destination then I have to skip and goto next level. I also need to delete the files in... (4 Replies)
Discussion started by: srmadab
4 Replies

3. UNIX for Dummies Questions & Answers

copy files with directory structure

i have a text file as. /database/sp/NTR_Update_Imsi_List.sql /database/sp/NTR_Update_Imsi_Range_List.sql /database/sp/NTR_Vlr_Upload.sql /database/tables/StatsTables.sql /mib/ntr.mib /mib/ntr.v2.mib /scripts/operations/ntr/IMSITracer.ph /scripts/operations/ntr/IMSITracer.pl ... (3 Replies)
Discussion started by: adddy
3 Replies

4. SCO

Transfer files wih directory structure.

I need to transfer software off a SCO OpenServer 5.0.5 server. I can not seem to read this server's tape on my other server since the tape drive (IBM Gen 5 DAT 72GB) will continuosly "eject" this DAT 8 tape. I have been able to 'tarball' most of the smaller directories with success and... (11 Replies)
Discussion started by: uxlunatick
11 Replies

5. Shell Programming and Scripting

Script to remove all empty files within the directory structure?

Hi I need to write a shell script which basically searches for all the empty files within the directory structure, lists them before asking the user to confirm if they would like to delete them. If the user deletes the file then a notice would appear confirming the file is deleted. I've be... (5 Replies)
Discussion started by: cat123
5 Replies

6. Programming

C++: how to check my directory disk space

I have a directory, and I write some files in to that. How to throw the error exception when my directory is full. i.e. there is no disk space (2 Replies)
Discussion started by: SamRoj
2 Replies

7. Shell Programming and Scripting

How to traverse directory structure and sum size of files?

How do I write a bash or ruby or perl or groovy script to print all the files in my directory tree that are one-to-two years old, the size of each file, and the sum of file sizes and then delete them? I was using find . -atime +365 -exec rm '{}' \; but the problem was that I could not... (5 Replies)
Discussion started by: siegfried
5 Replies

8. Shell Programming and Scripting

Extract files from tar ball without directory structure

Hi, I have tar filw which has multiple directories which contain files. When i extract using tar -xf the directory structure also get extracted. I require only files and not directory structures as there will be overhead of moving the files again. So i searched here and got a solution but... (4 Replies)
Discussion started by: chetan.c
4 Replies

9. Shell Programming and Scripting

Archiving files keeping the same structure directory

Hello Team, We would like to backup a lot of files inside of a structure of directories, four, five or more levels in some Ubuntu, Mac and Solaris systems. For instance: /home/chuck/sales/virgin/rent-quote.pdf /home/chuck/sales/marriott/vacation-quote.pdf... (2 Replies)
Discussion started by: csierra
2 Replies
lcov(1) 							   User Manuals 							   lcov(1)

NAME
lcov - a graphical GCOV front-end SYNOPSIS
lcov -c|--capture [-d|--directory directory] [-k|--kernel-directory directory] [-o|--output-file tracefile] [-t|--test-name testname] [-b|--base-directory directory] [-i|--initial] [--gcov-tool tool] [--checksum] [--no-checksum] [--no-recursion] [-f|--follow] [--compat-libtool] [--no-compat-libtool] [--ignore-errors errors] [--to-package package] [--from-package package] [-q|--quiet] [--no-markers] lcov -z|--zerocounters [-d|--directory directory] [--no-recursion] [-f|--follow] [-q|--quiet] lcov -l|--list tracefile [-q|--quiet] [--list-full-path] [--no-list-full-path] lcov -a|--add-tracefile tracefile [-o|--output-file tracefile] [--checksum] [--no-checksum] [-q|--quiet] lcov -e|--extract tracefile pattern [-o|--output-file tracefile] [--checksum] [--no-checksum] [-q|--quiet] lcov -r|--remove tracefile pattern [-o|--output-file tracefile] [--checksum] [--no-checksum] [-q|--quiet] lcov --diff tracefile diff [-o|--output-file tracefile] [--checksum] [--no-checksum] [--convert-filenames] [--strip depth] [--path path] [-q|--quiet] lcov [-h|--help] [-v|--version] DESCRIPTION
lcov is a graphical front-end for GCC's coverage testing tool gcov. It collects line, function and branch coverage data for multiple source files and creates HTML pages containing the source code annotated with coverage information. It also adds overview pages for easy naviga- tion within the file structure. Use lcov to collect coverage data and genhtml to create HTML pages. Coverage data can either be collected from the currently running Linux kernel or from a user space application. To do this, you have to complete the following preparation steps: For Linux kernel coverage: Follow the setup instructions for the gcov-kernel infrastructure: http://ltp.sourceforge.net/coverage/gcov.php For user space application coverage: Compile the application with GCC using the options "-fprofile-arcs" and "-ftest-coverage". Please note that this man page refers to the output format of lcov as ".info file" or "tracefile" and that the output of GCOV is called ".da file". OPTIONS
-a tracefile --add-tracefile tracefile Add contents of tracefile. Specify several tracefiles using the -a switch to combine the coverage data contained in these files by adding up execution counts for matching test and filename combinations. The result of the add operation will be written to stdout or the tracefile specified with -o. Only one of -z, -c, -a, -e, -r, -l and --diff may be specified at a time. -b directory --base-directory directory Use directory as base directory for relative paths. Use this option to specify the base directory of a build-environment when lcov produces error messages like: ERROR: could not read source file /home/user/project/subdir1/subdir2/subdir1/subdir2/file.c In this example, use /home/user/project as base directory. This option is required when using lcov on projects built with libtool or similar build environments that work with a base direc- tory, i.e. environments, where the current working directory when invoking the compiler is not the same directory in which the source code file is located. Note that this option will not work in environments where multiple base directories are used. In that case repeat the lcov call for each base directory while using the --ignore-errors option to prevent lcov from exiting when the first source code file could not be found. This way you can get partial coverage information for each base directory which can then be combined using the -a option. -c --capture Capture coverage data. By default captures the current kernel execution counts and writes the resulting coverage data to the standard output. Use the --directory option to capture counts for a user space program. The result of the capture operation will be written to stdout or the tracefile specified with -o. Only one of -z, -c, -a, -e, -r, -l and --diff may be specified at a time. --checksum --no-checksum Specify whether to generate checksum data when writing tracefiles. Use --checksum to enable checksum generation or --no-checksum to disable it. Checksum generation is disabled by default. When checksum generation is enabled, a checksum will be generated for each source code line and stored along with the coverage data. This checksum will be used to prevent attempts to combine coverage data from different source code versions. If you don't work with different source code versions, disable this option to speed up coverage data processing and to reduce the size of tracefiles. --compat-libtool --no-compat-libtool Specify whether to enable libtool compatibility mode. Use --compat-libtool to enable libtool compatibility mode or --no-compat-libtool to disable it. The libtool compatibility mode is enabled by default. When libtool compatibility mode is enabled, lcov will assume that the source code relating to a .da file located in a directory named ".libs" can be found in its parent directory. If you have directories named ".libs" in your build environment but don't use libtool, disable this option to prevent problems when capturing coverage data. --convert-filenames Convert filenames when applying diff. Use this option together with --diff to rename the file names of processed data sets according to the data provided by the diff. --diff tracefile difffile Convert coverage data in tracefile using source code diff file difffile. Use this option if you want to merge coverage data from different source code levels of a program, e.g. when you have data taken from an older version and want to combine it with data from a more current version. lcov will try to map source code lines between those versions and adjust the coverage data respectively. difffile needs to be in unified format, i.e. it has to be created using the "-u" option of the diff tool. Note that lines which are not present in the old version will not be counted as instrumented, therefore tracefiles resulting from this operation should not be interpreted individually but together with other tracefiles taken from the newer version. Also keep in mind that converted coverage data should only be used for overview purposes as the process itself introduces a loss of accuracy. The result of the diff operation will be written to stdout or the tracefile specified with -o. Only one of -z, -c, -a, -e, -r, -l and --diff may be specified at a time. -d directory --directory directory Use .da files in directory instead of kernel. If you want to work on coverage data for a user space program, use this option to specify the location where the program was com- piled (that's where the counter files ending with .da will be stored). Note that you may specify this option more than once. -e tracefile pattern --extract tracefile pattern Extract data from tracefile. Use this switch if you want to extract coverage data for only a particular set of files from a tracefile. Additional command line parameters will be interpreted as shell wildcard patterns (note that they may need to be escaped accordingly to prevent the shell from expanding them first). Every file entry in tracefile which matches at least one of those patterns will be extracted. The result of the extract operation will be written to stdout or the tracefile specified with -o. Only one of -z, -c, -a, -e, -r, -l and --diff may be specified at a time. -f --follow Follow links when searching for .da files. --from-package package Use .da files in package instead of kernel or directory. Use this option if you have separate machines for build and test and want to perform the .info file creation on the build machine. See --to-package for more information. --gcov-tool tool Specify the location of the gcov tool. -h --help Print a short help text, then exit. --ignore-errors errors Specify a list of errors after which to continue processing. Use this option to specify a list of one or more classes of errors after which lcov should continue processing instead of aborting. errors can be a comma-separated list of the following keywords: gcov: the gcov tool returned with a non-zero return code. source: the source code file for a data set could not be found. -i --initial Capture initial zero coverage data. Run lcov with -c and this option on the directories containing .bb, .bbg or .gcno files before running any test case. The result is a "baseline" coverage data file that contains zero coverage for every instrumented line. Combine this data file (using lcov -a) with coverage data files captured after a test run to ensure that the percentage of total lines covered is correct even when not all source code files were loaded during the test. Recommended procedure when capturing data for a test case: 1. create baseline coverage data file # lcov -c -i -d appdir -o app_base.info 2. perform test # appdir/test 3. create test coverage data file # lcov -c -d appdir -o app_test.info 4. combine baseline and test coverage data # lcov -a app_base.info -a app_test.info -o app_total.info -k subdirectory --kernel-directory subdirectory Capture kernel coverage data only from subdirectory. Use this option if you don't want to get coverage data for all of the kernel, but only for specific subdirectories. This option may be specified more than once. Note that you may need to specify the full path to the kernel subdirectory depending on the version of the kernel gcov support. -l tracefile --list tracefile List the contents of the tracefile. Only one of -z, -c, -a, -e, -r, -l and --diff may be specified at a time. --list-full-path --no-list-full-path Specify whether to show full paths during list operation. Use --list-full-path to show full paths during list operation or --no-list-full-path to show shortened paths. Paths are shortened by default. --no-markers Use this option if you want to get coverage data without regard to exclusion markers in the source code file. See geninfo (1) for details on exclusion markers. --no-recursion Use this option if you want to get coverage data for the specified directory only without processing subdirectories. -o tracefile --output-file tracefile Write data to tracefile instead of stdout. Specify "-" as a filename to use the standard output. By convention, lcov-generated coverage data files are called "tracefiles" and should have the filename extension ".info". --path path Strip path from filenames when applying diff. Use this option together with --diff to tell lcov to disregard the specified initial path component when matching between tracefile and diff filenames. -q --quiet Do not print progress messages. This option is implied when no output filename is specified to prevent progress messages to mess with coverage data which is also printed to the standard output. -r tracefile pattern --remove tracefile pattern Remove data from tracefile. Use this switch if you want to remove coverage data for a particular set of files from a tracefile. Additional command line parame- ters will be interpreted as shell wildcard patterns (note that they may need to be escaped accordingly to prevent the shell from expanding them first). Every file entry in tracefile which matches at least one of those patterns will be removed. The result of the remove operation will be written to stdout or the tracefile specified with -o. Only one of -z, -c, -a, -e, -r, -l and --diff may be specified at a time. --strip depth Strip path components when applying diff. Use this option together with --diff to tell lcov to disregard the specified number of initial directories when matching tracefile and diff filenames. -t testname --test-name testname Specify test name to be stored in the tracefile. This name identifies a coverage data set when more than one data set is merged into a combined tracefile (see option -a). Valid test names can consist of letters, decimal digits and the underscore character ("_"). --to-package package Store .da files for later processing. Use this option if you have separate machines for build and test and want to perform the .info file creation on the build machine. To do this, follow these steps: On the test machine: - run the test - run lcov -c [-d directory] --to-package file - copy file to the build machine On the build machine: - run lcov -c --from-package file [-o and other options] This works for both kernel and user space coverage data. Note that you might have to specify the path to the build directory using -b with either --to-package or --from-package. Note also that the package data must be converted to a .info file before recompiling the program or it will become invalid. -v --version Print version number, then exit. -z --zerocounters Reset all execution counts to zero. By default tries to reset kernel execution counts. Use the --directory option to reset all counters of a user space program. Only one of -z, -c, -a, -e, -r, -l and --diff may be specified at a time. FILES
/etc/lcovrc The system-wide configuration file. ~/.lcovrc The per-user configuration file. AUTHOR
Peter Oberparleiter <Peter.Oberparleiter@de.ibm.com> SEE ALSO
lcovrc(5), genhtml(1), geninfo(1), genpng(1), gendesc(1), gcov(1) 2010-08-06 LCOV 1.9 lcov(1)
All times are GMT -4. The time now is 12:14 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy