cleaning up

Dan Villiom Podlaski Christiansen danchr at gmail.com
Tue Jan 12 08:57:12 PST 2010


On 12 Jan 2010, at 02:15, Bradley Giesbrecht wrote:

> 
> On Jan 11, 2010, at 4:30 PM, Jeremy Lavergne wrote:
> 
>>> Restoring from a backup is a terrible solution. I make nightly backups of my databases but loosing a days worth of data will make me very unpopular.
>>> Likewise losing all the emails in an imap mailbox would make me equally unpopular. I think for me it's best to just move user data outside /opt/local. I already moved it all to a subdir of /opt/local/var I should have just moved it outside /opt/local altogether and I wouldn't be worried about find $prefix -exec rm commands.
>> 
>> If it's all in $prefix/var, just run a find command for bin, etc, include, lib, and share.
> 
> Good idea.
> 
> I couldn't manage to get find -path '/opt/local/var' -prune to work but ! seems to work.
> 
> sudo find /opt/local \( ! -path "/opt/local/var/*" -a ! -path "/opt/local/apache2/*" -a ! -path "/opt/local/www/*" \) -name *.mp_*
> 
> I think these are two other directories that some of the ports may park user files like some of the web frameworks that allow user uploads.

After a bit of tweaking, I'd suggest:

sudo find /opt/local -regex '.*/[^/]\{1,\}\.mp_[[:digit:]]\{9,10\}' -print -delete

If you don't have any very old files, or files which were created when the clock was reset:

sudo find /opt/local -regex '.*/[^/]\{1,\}\.mp_[[:digit:]]\{10\}' -print -delete

Or, if you want to ignore anything in a ‘var’ directory:

sudo find /opt/local  \( -not -path '*/var/*' \) -regex '.*/[^/]\{1,\}\.mp_[[:digit:]]\{9,10\}' -print -delete

The first one should be quite safe; user files are unlikely to end with ‘.mp_’ followed by 9–10 digits ;-)

--

Dan Villiom Podlaski Christiansen
danchr at gmail.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-dev/attachments/20100112/9ad88ae4/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 1943 bytes
Desc: not available
URL: <http://lists.macosforge.org/pipermail/macports-dev/attachments/20100112/9ad88ae4/attachment.bin>


More information about the macports-dev mailing list