[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [TIGGE #BXZ-922182]: Re: .missing files & retransmissions



Manuel/Steve,
I don't have a particular "tool" other than we have a script in cron
that recursively walks a directory tree and tries to delete directories.
It it succeeds, then the directory was empty. 

Attached is the csh source from our LDM's cron tab.

Steve Chiswell
Unidata User Support

On Fri, 2006-05-05 at 08:25, Manuel Fuentes wrote:
> Hello Steve,
> 
> I have not received anything from Steve Chiswell. Would it be possible 
> to integrate his tool within scour ?
> 
> We are trying to create a framework for all the TIGGE Data Providers, in 
> order to simplify installation and operation. Obviously, the less number 
> of tools to handle, the better.
> 
> Your help is appreciated.
> 
> Thanks,
> Manuel
> 
> Unidata IDD TIGGE Support wrote:
> > 
> > Steve Chiswell has a utility that removes directories as well as 
> > regular files.  I sent him a copy of this reply.
> > 
> > Regards,
> > Steve Emmerson
> > 
> > Ticket Details
> > ===================
> > Ticket ID: BXZ-922182
> > Department: Support IDD TIGGE
> > Priority: Normal
> > Status: Closed
> > 
#!/bin/csh -f
# remove empty subdirectorys under a given path

if($#argv < 1) then
   echo 'Usage: scour_empty.csh directory'
   exit
endif


cd $1

if ( $#argv > 1 ) then
   # scour pattern
   echo scour by pattern $2
   set FILES=`ls -Ad $2`
else
   set FILES=`ls -A`
endif
if($#FILES < 1) exit

START:

#echo FILES $#FILES
#echo look $FILES

if($#FILES > 0) then
   set FILE=$FILES[1]
   shift FILES
   if(-d $FILE) then
      cd $FILE
      echo NOW in $cwd
      set LOOK=`ls`
      echo look $#LOOK
      if($#LOOK < 1) then
         cd ..
         rmdir $FILE
      else
         set NEW=(`ls` $FILE $FILES)
         set FILES=($NEW)
      endif
   else
      if(! -e $FILE) then
         cd ..
      endif
   endif
   #echo here $cwd
   goto START
endif