Split/create directories on basis of their size


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Split/create directories on basis of their size
# 1  
Old 07-28-2005
Split/create directories on basis of their size

Hi,

I would really apprciate it if someone expert in shell, "shell guru" scripting can help me.

with a shell command how can I create directories and populate on basis of size.
Before I confuse you, let me tell you the scenerio.

We take hot database backup of oracle on disk, and compress/gzip it.
This is done by a shell script which softlinks every last days backup as LATEST (create a soft link to mon,tue,wed,thur,fri,sat,sun whatever is the last day).
As this backup goes into days(moin tue,wed,thur etc) directory. Because the size after compression is more then 250 Gb, netbackup takes ages to back it up.

What I am looking for is, that database backup should be splitted into different directories on basis of size, 25Gb each dir. The script should be able to create directory dir1_1, dir1_2 etc and then put all the *.dbf etc in each directory not more then 25Gb and when it reach the limit it should create another dir, dir1_3 and so on, and copy the file over and so on untill all the *.dbf files in the "last days" dir are copied.
The problem is it should only to dir where symbolic link LATEST points to wether it's monday or tue etc.
So netbackup can back it up in parallel.

Thanks
Amit
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Split large file into 24 small files on one hour basis

I Have a large file with 24hrs log in the below format.i need to split the large file in to 24 small files on one hour based.i.e ex:from 09:55 to 10:55,10:55-11:55 can any one help me on this.! ... (20 Replies)
Discussion started by: Raghuram717
20 Replies

2. UNIX for Beginners Questions & Answers

Split a txt file on the basis of line number

I have to split a file containing 100 lines to 5 files say from lines ,1-20 ,21-30 ,31-40 ,51-60 ,61-100 Here is i can do it for 2 file but how to handle it for more than 2 files awk 'NR < 21{ print >> "a"; next } {print >> "b" }' $input_file Please advidse. Thanks (4 Replies)
Discussion started by: abhaydas
4 Replies

3. Shell Programming and Scripting

List directories on the basis of name

I have below directories. All directories create as per some some logging software by today so all directories current time is today date. Direct 2013-08-12 23123 Direct 2013-08-13 24121 Direct 2013-08-14 34513 Direct 2013-08-31 15435 ........... Direct 2013-09-12 53145 Direct... (5 Replies)
Discussion started by: learnbash
5 Replies

4. Shell Programming and Scripting

Directories above particular size

Hi guys, i'm searching for a command, which gives me back all the directories which are greater than a particular size? thx for helping so far :b: guti (2 Replies)
Discussion started by: guti_rocks
2 Replies

5. Shell Programming and Scripting

Split one file to Multiple file with report basis in unix

Hi, Please help on this. i want split the below file(11020111.CLT) to more files with some condition. :b: 1) %s stating of the report 2) %e ending of the report example starting of the report: %sAEGONCA| |MUMBAI | :EXPC|N|D ending of the report %eAEGONCA| |MUMBAI | :EXPC 3)so the... (10 Replies)
Discussion started by: krbala1985
10 Replies

6. Shell Programming and Scripting

How to list all the directories, sub directories in a mount along with size in ascending order?

Hi , I am very new to unix as well as shell scripting. I have to write a script for the following requirement. In a particular mount, have to list all the directories and sub directories along with size of the directory and sub directory in ascending order. Please help me in this regard and many... (4 Replies)
Discussion started by: nmakkena
4 Replies

7. Shell Programming and Scripting

split on the basis of 2nd and 3rd column

file A aa 22 48 ab 22 48 tcf 50 76 gf 50 76 h 89 100 yh 89 100 how can we split the file on the basis of common 2 and third column output like file A-1 aa 22 48 ab 22 48 file A-2 cf 50 76 gf 50 76 (3 Replies)
Discussion started by: cdfd123
3 Replies

8. Shell Programming and Scripting

check if multiple directories exist else create missing directories

Hi , I 'm trying to check if multiple directories exist on a server, if not create the missing ones and print " creating missing directory. how to write this in a simple script, I have made my code complex if ; then taskStatus="Schema extract directory exists, checking if SQL,Count and... (7 Replies)
Discussion started by: ramky79
7 Replies

9. Shell Programming and Scripting

Hiding Directories on a Session by Session basis

Hi, Apologies if anyone has read my recent post on the same subject in the Linux forum, just thought actually the solution might more likely come from scripting. Essentially, I am trying to restrict access to directories based on the user's name AND their location on a session-by-session... (3 Replies)
Discussion started by: en7smb
3 Replies

10. HP-UX

Directories Size

Hi All I want to plan my backups, but 1st i would like to know what is the size of each directory. Is there any command which can show me the size of directories? Regards (2 Replies)
Discussion started by: cgege
2 Replies
Login or Register to Ask a Question
shell(1F)							   FMLI Commands							 shell(1F)

NAME
shell - run a command using shell SYNOPSIS
shell command [command] ... DESCRIPTION
The shell function concatenate its arguments, separating each by a space, and passes this string to the shell ($SHELL if set, otherwise /usr/bin/sh). EXAMPLES
Example 1: A sample output of shell command. Since the Form and Menu Language does not directly support background processing, the shell function can be used instead. `shell "build prog > /dev/null &"` If you want the user to continue to be able to interact with the application while the background job is running, the output of an exe- cutable run by shell in the background must be redirected: to a file if you want to save the output, or to /dev/null if you don't want to save it (or if there is no output), otherwise your application may appear to be hung until the background job finishes processing. shell can also be used to execute a command that has the same name as an FMLI built-in function. NOTES
The arguments to shell will be concatenate using spaces, which may or may not do what is expected. The variables set in local environments will not be expanded by the shell because "local" means "local to the current process." ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWcsu | +-----------------------------+-----------------------------+ SEE ALSO
sh(1), attributes(5) SunOS 5.10 5 Jul 1990 shell(1F)