From: Jeffrey J. K. <bac...@ko...> - 2009-12-02 14:10:59
|
Christian Völker wrote at about 10:51:04 +0100 on Wednesday, December 2, 2009: > Hi, > > as it happens sometimes BackupPC backs up files not wanted to be stored > (usually due to misconfiguration ;)) I looked for an easy way to remove > files from BackupPC pool. So I found an old email in this list pointing > to > http://sourceforge.net/apps/mediawiki/backuppc/index.php?title=BackupPC_DeleteFile > > Seems to work fine so far. I was able to remove the most space waisting > "*.vmdk" files :) > > Unfortunately I'm unsure how this script recons files. What do you mean by "recons" or is that a typo? > So I invoked it with > ./backuppc_delete.pl -r -t -c -s - -m -h ns -n - "*/*.iso" > > Files/directories deleted: 0(0) Files/directories copied: 0 > Delete attrib set: 0 Attributes cleared: 0 > Empty attrib files deleted: 0 Errors: 0 > > And it does not display any *.iso files. But browsing through the web > frontend I see couple of them in the backups: > /ftp/pub/linux/ubuntu-8.04.2-desktop-i386.iso > > So what syntax do I have to use to find all iso files? > > Thanks! > The answer is that the "*" operator is file globbing (like 'ls') and not the general regex operator "*" -- i.e., it doesn't match "/". This is by design since file globbing is much faster (and in some ways safer) than doing a 'find' on the directory tree. I suggest you first manually do a find on a sample backup tree to find where the iso files are and then construct the path with or without (globbing) to delete them. You could also do something like this to do it all at once. ./backuppc_delete.pl -t -c -h ns -n - `(cd /var/lib/BackupPC/pc/ns ; find . -name "*.iso"| sed -ne "s#./[^/]\+/##p")` where you first cd to your pc tree and then find *.iso files and then use sed to remove the leading backup number directory. Note: 1. Keep the '-t' there to test this works and that it is not about to remove things you don't want 2. Since find returns files with mangling, I removed the '-m' flag. 3. Don't use the -r since you are not removing directories (presumably) 4. The -s flag is not necessary since the find is returning the share part of the path. |