Operating System - HP-UX
1752861 Members
4438 Online
108790 Solutions
New Discussion

Re: HP-UX find command unable to remove files from directories multiple levels deep

 
SOLVED
Go to solution
James R. Ferguson
Acclaimed Contributor

Re: HP-UX find command unable to remove files from directories multiple levels deep

Hi (again):

Since you have given a "bunny" at this point, suggesting a solution to your problem, what exactly was the solution?

Regards!

...JRF...
kaushikbr
Frequent Advisor

Re: HP-UX find command unable to remove files from directories multiple levels deep

Hi All

Thank you all for your valuable comments.
Dennis Handly's suggestion of cd to the directory and remove the files from CWD worked. It was a bit of a workaround, but it worked.
Here is what I have changed in the script.


find "$direc" -type f >> ${REMOVEFILE_LIST}

while read FILE2REMOVE
do
echo "File --- "
echo "$FILE2REMOVE"
echo " "
cd $(dirname "$FILE2REMOVE")
ls -l "$(basename "$FILE2REMOVE")"
rm "$(basename "$FILE2REMOVE")"
ls -l "$(basename "$FILE2REMOVE")"
done < ${REMOVEFILE_LIST}