cleanup script needed

Dennis G. Rears FSAC drears at PICA.ARMY.MIL
Tue May 9 02:38:18 AEST 1989


rkumar at buddha.usc.edu  writes:
>
>This may be quite silly to the UNIX wizards.
>
>1) Frequently I need to erase unnecessary files to save space.
>It would be nice to have a script which removes all
>the files with a specified extension, e.g., .dvi or .aux
>not only in the current directory, but in all the 
>children directories recursively. 
>Will rm -r *.dvi do the job? Since it is an "rm" command,
>I don't want to try it out ... 

  /bin/find DIR -name "*.dvi" -exec rm -f {} \;

  DIR is the directory that is where you want to start from.  The
*.dvi must be enclosed in quotes.  You might want to use the -i option of
rm as opposed to -f depending upon application. 
>
>2) Sometimes I create a file in a directory which is deep
>down in a directory hierarchy. Any quick way to search for
>a file, given its name/template?
>
  /bin/find DIR -name "filename" -exec ls -l {} \;

   This will do it.  This will give the full path name.
>Thanks 
>Ravi


Dennis

			Dennis G. Rears
			ARPA: drears at ac4.pica.army.mil   
			UUCP:  ...!uunet!ac4.pica.army.mil!drears



More information about the Comp.unix.questions mailing list