Please verify the simple Shell code


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Please verify the simple Shell code
# 1  
Old 10-04-2007
Please verify the simple Shell code

Hi,

i am trying to write script which will delete files(more than 90 days older) from different directories. Please check its ok if i implement it in SUN solaris10; One important thing i used here "exec" flag. I heard from someone- as i have lots of files "exec" flag may give error like too long argument. So, what should i do to remove huge files.

#!/usr/bin/sh

find /var/opt/backup/cam* -mtime +90 -exec rm {} \;
find /var/opt/backup/tmp/zam* -mtime +90 -exec rm {} \;

find /var/opt/otherbackup/cat* -mtime +90 -exec rm {} \;

find /var/opt/otherbackup/cat* -mtime +5 -exec rm {} \;
# 2  
Old 10-04-2007
Try piping to xargs
Code:
find /var/opt/otherbackup/cat* -mtime +5 -print | xargs -n 100 rm -f

... should do the trick
# 3  
Old 10-04-2007
Isn't this a duplicate thread ??? ...
https://www.unix.com/shell-programmin...ry-delete.html
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell script verify connection to Oracle if not successful

i have a script that connects to the oracle database and executes the query statements. it works fine and i would like to add some message to check if the connection to oracle is not successful. basically this is the code snippet: #!/bin/sh ... ... ... sqlplus -s username/password@dbName... (2 Replies)
Discussion started by: wtolentino
2 Replies

2. Shell Programming and Scripting

How to integrate all the systemctl commands into a shell script to verify any daemon/agent service?

Hi, Can we integrate all the systemctl command into a shell script to verify any service with all the options of systemctl if service integrate with the operating system service management tools to deliver their functionality. sudo systemctl start <service_name> sudo systemctl stop... (1 Reply)
Discussion started by: Mannu2525
1 Replies

3. Shell Programming and Scripting

Can Help me in simple perl code

Hi all i want a program have input file .txt and process it then got output Ex: input: King Saud University say hi Mr.Ahmed Cena have a car perl is good ! Dr.john is good! output: KSU say hi Mr.AC have a car perl is good! Dr.John is good! so the process take the String has... (3 Replies)
Discussion started by: abdulelah252
3 Replies

4. Cybersecurity

please help to verify the simple firewall rules is ok for the call testing of my VOIP telephony syst

Dear Sir, I want to test the VOIP Telephony system installed in a IP PBX server behind a NAT router. This NAT router connects to a modem (with NAT as well), and then the modem (with static public IP assigned by the ISP, e.g. 219.45.67.80) directly connects to the Internet. There are several... (0 Replies)
Discussion started by: qiubosu
0 Replies

5. Shell Programming and Scripting

Can someone verify the code of two function

Input=D123,S1234,D345 | kESTREL PRODUCTION SUPPORT echo -en "Enter the logmsg=" read logmsg logmsg1=${logmsg%%|*}; echo "$logmsg1"|tr ',' '\n' | sed 's/*$ | sed '/^$/d'//'>pre-commit.config Char() { while read line do if ] || ];then echo "Success" else exit 1;... (1 Reply)
Discussion started by: rohit22hamirpur
1 Replies

6. Shell Programming and Scripting

Need assistance with simple shell script to organize files. [Code attached]

I need some help with this shell script for class. All it does is organize your files. It works, but in the log file, it needs to show the new filepaths of the moved files. Heres my log of my output: Starting to organize... movie2.wmv --> movie3.mov --> movie1.mpg --> song1.mp3 --> ... (3 Replies)
Discussion started by: ryandamartini
3 Replies

7. Shell Programming and Scripting

simple shell

Hi everyone I am writing a simple shell but the background '&' not working i dont understand this is my fork pid_t pid; pid=fork(); if(pid<0) { printf("\nChild process failed."); exit(1);... (2 Replies)
Discussion started by: basicxx
2 Replies

8. Shell Programming and Scripting

simple shell - how to get a parameter typed in a shell script

Hi, I am new to unix and using linux 7.2. I would like to create a script that would make it easyer for me to run my java programms. At the moment I have to type java myJavaprogram I am trying to write a script that will allow me to type something like this "myscript myJavaprogram" or maybe... (4 Replies)
Discussion started by: cmitulescu
4 Replies

9. UNIX for Advanced & Expert Users

I need of a simple shell script

Hi, I need of a simple shell script to launch a perl script. The complet path of the script is: /export/home/x2693/project/v02/appliancemanagement.pl (2 Replies)
Discussion started by: Minguccio75
2 Replies

10. Shell Programming and Scripting

simple shell scripts

hi everyone... i'm new to this shell programming and i want help with the following question... i hope someone can help me ...pls plsssssssssss ========================================================== the question ========================================================== A number of... (1 Reply)
Discussion started by: moon14
1 Replies
Login or Register to Ask a Question