PDA

View Full Version : Finding distfiles one may not need to keep, for deletion.


jb_fvwm2
November 11th, 2011, 05:39
Some may keep distfiles in /usr/ports/distfiles, say if a port has a minor version bump and one does not wish to re-dowload. However, there may be
Thisport-1.gz
Thisport-2.gz etc which were inadvertantly left behind, say by an interrupted
portmaster run or equivalent.

# only've tried it with gnuls
cd /usr/ports/distfiles
gnuls -R "*.Z" "*.zip" "*.bz2" "*.gz" "*.tgz" -1 | sort | tee -a /tmp/fil.1
tr -d "[:digit:]" < fil.1 > fil.2
cat fil.2 | uniq -d
If one is fortunate, only a few extra files to delete will be shown by the last command in the sequence, and one's shell (if configured to) can complete the filenames as one deletes the duplicates.
[I discovered the gnuls part previously, but only very recently the freebsd-questions list mentioned the tr command.]
.....
Not quite yet able to use the suggestions below as I've many .dat, subdirectories (etc) in /usr/ports/distfiles from the days I saved every other file there, comments, coding tests etc. ( .. and busy at the moment with other configuration tasks...)

SirDice
November 11th, 2011, 08:41
If you have portmaster installed:
portmaster --cleandistfiles

If you have portupgrade installed:
portsclean --distclean

wblock@
November 11th, 2011, 15:17
If you have portmaster installed:
portmaster --cleandistfiles

Needs one more dash: --clean-distfiles. Run without options, it removes old distfiles for any installed port. To get rid of all outdated distfiles, add -t. It can take a while. Add -y to automatically answer yes to the "Are you really, really, ultra-triple-sure you want to remove this file?" questions.
portmaster -t -y --clean-distfiles

SirDice
November 11th, 2011, 16:25
Needs one more dash: --clean-distfiles.
Oops. Did that one from the top of my head :r