Sponsored Content
Top Forums Shell Programming and Scripting Sum of file size in directory / subdirectory Post 302452181 by Scott on Thursday 9th of September 2010 01:17:02 PM
Old 09-09-2010
Hi.

Why did you skip the first 5 rows?

Code:
$ awk '{T+=$5} END {print T}' inputfile
494495

Find also has an ls option, so no need for exec, really.

Your find also doesn't exclude directories (i.e. maybe you want -type f in there).
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to calculate file's size in directory and subdirectory

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)
Discussion started by: KLL
4 Replies

2. UNIX for Dummies Questions & Answers

Create Year directory, date subdirectory and archive the file

Hi, After checking all the UNIX threads, I am able to come up with a solution so far. I am working on a shell script where it moves the files to a certain directory. The conditions to check are 1) Check if the file exists in the current directory. 2) Check if the destination directory... (2 Replies)
Discussion started by: madhunk
2 Replies

3. Solaris

Directory size larger than file system size?

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)
Discussion started by: sparcman
6 Replies

4. 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

5. Shell Programming and Scripting

Search for file and size subdirectory as well

Hi I made this code to search in directory for file and size How can I remodel it to seach in the sub direcotry as well Thanks #!/bin/bash echo -n "Enter: " read var if then echo "Directory exists: ${var}" size=`du -hs "${var}"` echo The size of the current folder is... (4 Replies)
Discussion started by: lio123
4 Replies

6. Shell Programming and Scripting

How can i find a word inside a file from a directory and it's subdirectory ?

Suppose i have a word "mail". I have to search this word in all files inside a directory and it's sub-directories. It will also search in all hidden directory and sub-directories. If it finds this word in any file it will list that file. How can i do this with perl/ruby/awk/sed/bash or... (9 Replies)
Discussion started by: cola
9 Replies

7. UNIX for Dummies Questions & Answers

How to get the set of files size as a sum in a directory.

Hi, Can someone help me to get the complete files size (sum) over a perod time (1 day,2days)in a directory. eg: Directory :ABC I have a1,a2,a3 files are created in last 24 hours so I need to get the some of all these files. I am using the below find command but its giving me the... (1 Reply)
Discussion started by: gaddamja
1 Replies

8. Shell Programming and Scripting

Move all files not in a directory into a subdirectory named for each given file

Hi Everyone! Looking for some help with a script that will take all files in any given root folder (which are not already in a folder) and put them into separate folders with the name of each given file. Any ideas? Thank you! (1 Reply)
Discussion started by: DanTheMan
1 Replies

9. UNIX for Dummies Questions & Answers

Ls directory size reporting byte size instead of file count

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)
Discussion started by: jmgibby
2 Replies

10. Shell Programming and Scripting

Searching File in Directory and all Subdirectory and Delete

Hi All, My directory structure is like Directory1 SubDirectory1 SubDirectory2 SubDirectory3 I have main directories and subdirectories underneath. I want to write a shell script where I will be passing file name as a parameter, Now I want to find all the files in Directory1... (19 Replies)
Discussion started by: John William
19 Replies
GFS_RENAME(3)															     GFS_RENAME(3)

NAME
gfs_rename - change the name or location of a file SYNOPSIS
#include <gfarm/gfarm.h> char *gfs_rename (char * gfarm_url_from, char * gfarm_url_to); DESCRIPTION
gfs_rename renames a file or directory gfarm_url_from to gfarm_url_to. If gfarm_url_to already exists, it will be replaced. In this case, when gfarm_url_from is a file gfarm_url_to also must be a file, when gfarm_url_from is a directory, gfarm_url_to must be a empty directory. Gfs_rename() can't rename a directory to a subdirectory of itself. RETURN VALUES
NULL The function terminated successfully. GFARM_ERR_NO_MEMORY Insufficient memory was available. GFARM_ERR_AUTHENTICATION User authentication failed when connecting to gfmd(8). GFARM_ERR_PERMISSION_DENIED The parent directory of gfarm_url_from or gfarm_url_to did not allow write permission. GFARM_ERR_INVALID_ARGUMENT A attempt was made to rename the directory gfarm_url_from to a subdirectory of itself. GFARM_ERR_NO_SUCH_OBJECT gfarm_url_from does not exist. GFARM_ERR_IS_A_DIRECTORY gfarm_url_to is a existing directory, though gfarm_url_from is not a directory. GFARM_NOT_IS_A_DIRECTORY gfarm_url_to is not a directory. though gfarm_url_from is a directory. Others An error except the above occurred. The reason is shown by its pointed strings. Gfarm 13 November 2006 GFS_RENAME(3)
All times are GMT -4. The time now is 11:11 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy