Find and delete not working


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Find and delete not working
# 1  
Old 05-26-2011
Data Find and delete not working

Hi,

I have a .ksh script which finds all the directories older than 84 days and tries to housekeep. Below is the command used

find * -depth -type d -ctime +84 -exec rm -rf {} \;

The above command lists all the directories ie child and parent directory in descending order which are more than 84 days old

When the script is executed from unix prompt, it does what it was intended for.

But when the same is executed by calling from another .ksh script on a by a oracle batch scheduler it is deleting only the subfolders and not the parent folder.

Can someone throw some light on this.

Moderator's Comments:
Mod Comment Double post, continued here. Take a look at the rules again

Last edited by pludi; 05-26-2011 at 07:46 AM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Red Hat

RHEL 7: Backup Space and Delete is not working in console

Hi All, During my virtual machine power on i have rc3.d script to accept user inputs like IP address. This script gets executed during first time boot up. It was working fine till my VM is using RHEL6.5. Now we migrated to RHEL 7 environment. While accepting the user inputs in console, I... (4 Replies)
Discussion started by: kalpeer
4 Replies

2. Shell Programming and Scripting

Find with name not working from crontab

find without -name works fine. find with -name '*' works from interactive bash, but not from cron. mgr@someplace:~$ crontab -l | grep wsl 17 09 * * * /usr/bin/find /wsbj/logs/mgr/webServiceLogs -type f -mtime +30 > /home/mgr/wsl_find.out 17 09 * * * /usr/bin/find /wsbj/logs/mgr/webServiceLogs... (11 Replies)
Discussion started by: CarloM
11 Replies

3. Shell Programming and Scripting

Find not working right

if ] then leftarray=($(find . -type l -printf "%p\n" 2>/dev/null)) rightarray=($(find . -type l -printf "%l\n" 2>/dev/null)) for var in "${rightarray}" do maximumarray=`echo "$var" | tr -dc "/" | wc -c | tr -d " "` index=$(($index+1)) done ############# for numbers in... (3 Replies)
Discussion started by: xpukm
3 Replies

4. Shell Programming and Scripting

Working with FIND command

Hi , In /home/etc/files path ran the following command find . -name 'ABC*' | wc -l The output of the above command is 25 as expected In path /home path ran the following command find . -name '/home/etc/files/ABC*' | wc -l The output of the abvoe command is 0 . Why the above... (3 Replies)
Discussion started by: smile689
3 Replies

5. UNIX for Dummies Questions & Answers

Find with Prune not working

Hi I am trying to list all files in every subdirectory from a given location. However, I realise that 1 folder will have files that I am not interested in. This is using a .csh file to execute I have tried different scripts but to no avail. My current incarnation is below. Would someone be... (4 Replies)
Discussion started by: wonderbison
4 Replies

6. Programming

LDAP delete - seems not working

Hi all, I am very new to ldap and am facing the below difficulty. When I try to add something to ldap, I get this: server# /opt/iexpress/openldap/bin/ldapmodify -f almondabc.ldif -h 127.0.0.1 -xv -D cn=Manager,dc=almondabc,dc=com -w secret ldap_initialize( ldap://127.0.0.1 ) add o: ... (0 Replies)
Discussion started by: almond
0 Replies

7. Shell Programming and Scripting

find command not working

Hi all, find command not working for me in a perticular directory.The same command is working fine in any other directory. Following is the command i issued: find . -type f -print my question is , is it possbile to disable a command only for a perticular directory ??...of course... (4 Replies)
Discussion started by: panyam
4 Replies

8. Shell Programming and Scripting

find | gawk --- NOT WORKING

Hi every1:) I have a problem with find and Pipe to gawk. Find -name '*.txt' -> works fine.. Gives all the txt file under home directory and sub directories But when I use it like this (see below). Find -name '*.txt' | gawk -F '\t' "script" :confused: It doesn't work.... (22 Replies)
Discussion started by: Needhelp2
22 Replies

9. UNIX for Advanced & Expert Users

find command not working

Hi, Having issues with the . parameter in the find command. Issuing "find . -name \*.pl" gives me find: cannot open .: No such device I got it working by substituting . with *, so "find * -name \*.pl" gives the correct listing. bin/test.pl "which find" lists /bin/find. Anybody... (7 Replies)
Discussion started by: jabrady
7 Replies

10. Shell Programming and Scripting

How to find our working compiler

Hi, I am using Turbo Linux and needs to install Samba on it. But it said that could not find gcc. My question is how to find out which compiler is working on my system. I tried echo $CC but it gave me nothing. How can I set environmental compiler to c. Thanks in advance. (8 Replies)
Discussion started by: s_aamir
8 Replies
Login or Register to Ask a Question