deleting files inside shell script - ( using find)

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting deleting files inside shell script - ( using find)
# 1  
Old 05-27-2009
deleting files inside shell script - ( using find)

I am using the command find /apps/qualdb/gpcn/scripts/cab_outbound/archive -name 'z*' -mtime +28 -exec rm {} \;
in unix command prompt
for deleting the files in my unix system under the specfied folder. It was succesfull.

But when i running this command inside a shell script name it is giving an error message like find: missing argument to `-exec'

Why this is happening the same code when running in command prompt it is success bu running inside shell script it fails.Smilie.

Thanks for your help
# 2  
Old 05-27-2009
The same working fine for me...inside a shell script.

Check ur script once again ...You might hav missed somethng..
# 3  
Old 05-27-2009
Thanks for your help.

I have checked the shell script and it is fine.

I am having a shell script name
and it contains only one line which is
find /apps/qualdb/gpcn/scripts/cab_outbound/archive -name 'z*' -mtime +28 -exec rm {} \;

and when i am running using ksh it is showing exception as find: missing argument to `-exec'

the same thing when i am running in command prompt it is working fine.

Is there is any way to attach the file in this forum so that i can attcah the screen shot of whet i am trying.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Find all .sh files in file system and need to replace the string inside .sh files

Hi All, I need to write a script to find all "*.sh" files in /home file system and if any string find "*.sh" files with the name need to replace with I just understood about the find the command to search .sh files. Please help me on this. find / -name... (3 Replies)
Discussion started by: bhas85
3 Replies

2. UNIX for Beginners Questions & Answers

Find and removing the old files and zipping the files using shell script

Hi, I am trying to removing the old files which were older than 10 days and same g zipping the files using the shell script. script was return as follows. find /jboss7_homes/JBOSS7/SKYLIV??/SKYLIV??_CRM/jboss-eap-7.0/standalone/log -mtime +10 -type f | xargs rm -f find /cer_skyliv??/log... (6 Replies)
Discussion started by: venkat918
6 Replies

3. UNIX for Dummies Questions & Answers

deleting all the files inside a directory from a relative path

I have a file inside abc/def/ghi directory. let say a.txt I need to delete this a.txt from abc itself. I have tried ls /abc/def/ghi | xargs rm -r its saying rm: a.txt non-existent also tried rm -rf /def/ghi but in vein. plz help :) (2 Replies)
Discussion started by: gotam
2 Replies

4. Shell Programming and Scripting

Need help with shell script for moving/deleting/renaming files

Hi. I need help with a little script that will be used to move some files to their parent directory, delete the directory, rename one file in the parent directory and delete another, then continue to the next. Here's an example: /var/media/Music/Genesis/1970 album - Trespass (2008 Box -... (4 Replies)
Discussion started by: aflower
4 Replies

5. Shell Programming and Scripting

Shell script to find files

Hi Experts, I am trying to write a shell script that should 1. Find files with name (ab030.txt,Ab030.TXT,AB030.TXT,ab030.TXT,AB030.txt) 2. If any of the above found, rename it to AB030.TXT Thanks. (4 Replies)
Discussion started by: welldone
4 Replies

6. Shell Programming and Scripting

shell script reqd - deleting files

I have written a script that deletes files: Requirement: i need to delete the files and to know how many files are deleted i.e the count of files and even i need to display when the started time of deletion and the ending time of deletion. I need to display these two times. script: ... (2 Replies)
Discussion started by: venkatesht
2 Replies

7. Shell Programming and Scripting

Need script to find errored files inside directories

Hi people. I working on a script to check for files that they are suposed not to be on the directory. I mean, inside of each directory it must have some files but some could be wrong, and i want to move the files that are wrong. Ex: CSPOTGET edpst/CargadoresSPOT (4 Replies)
Discussion started by: osramos
4 Replies

8. Shell Programming and Scripting

shell script: deleting files from a directory

i have the following problem: use shell script: Two directories have to be searched for files havin the same name. then delete these files from one of these directories. the directory names have to be accepted as command line arguments. what i have done till now is: 1. run a loop... (1 Reply)
Discussion started by: onlyc
1 Replies

9. Shell Programming and Scripting

ftp files inside a shell script

I have a shell script where I am trying to ftp some files but I get the error message "EOF unclosed" every time the script reaches the ftp section. Here is how my script is written. #more code up here rm -f $object >> $LOG_FILE 2>&1 fi #end of if done #end of for loop ... (5 Replies)
Discussion started by: matrix1067
5 Replies

10. Shell Programming and Scripting

shell script to find files

I have a directory which contains files with different kinds of extensions .everyday a file with .log gets added to it .i want to extract the file with .log extension which is created with todays date . thanks in advance (2 Replies)
Discussion started by: naren_samba2005
2 Replies
Login or Register to Ask a Question

Featured Tech Videos