ports cleaning script

Parv parv at pair.com
Sun Jan 22 16:38:47 PST 2006


in message <43D41AC2.206 at ucsb.edu>,
wrote randall ehren thusly...
>
> a few years ago i wrote a small perl script to cleanup all ports
> that had a 'work' directory, aka a 'make clean'. it's quite
> simple, but i haven't found anything that does a similar thing.
> 
> cleanup_port_ports.pl:
> #!/usr/bin/perl
> 
> ####
> ###
> ## clean out the ports tree (remove all the 'work' directories)
> # randall s. ehren 20001011
> 
> @works = `/usr/bin/find /usr/ports/ -name work`;

That's very dangerous looking: that will find any file or directory
at any depth.  If you are going to put $PORTSDIR as hardcoded value,
why not add -depth & -type options ...

 find /usr/ports -name work -type d -depth 3

... ?

Or, just set $WRKDIRPREFIX and fire "rm -rf $WRKDIRPREFIX/*" at
will.


> foreach $directory (@works) {
>  print "removing $directory";
>  `/bin/rm -r $directory`;
> }


  - Parv

-- 



More information about the freebsd-ports mailing list