SearchFAQMemberlist Log in
Reply to topic Page 1 of 1
Search for and delete files from the pool
Author Message
Post Search for and delete files from the pool 
Hi Everyone,

I have a pool that is sitting at 100% with a gig or so free. Backuppc is
not running backups as it shouldn't. However, I would like to search the
backuppc data directory and delete any mp3, avi, etc. files that are in
there - and potentially - find all files that are bigger than 1 GB, check to
see if they are needed (my users sometimes keep multiple backup copies of
their pst files in different places on their hard drives and the servers)
and delete them from the pool and from the source PC after dumping them to
DVD. I know I have one user who has about 5 different copies of his 1.5GB
pst file (different dates) and I am betting there are more. Can someone
please help me with a command for this?

I think I need to search for any files that end with the right extension (in
the pc directory) and then pipe the result to rm -f. Then I believe I need
to run BackupPC_Nightly to remove the orphaned files in the pool directory.
I can delete it from the source disk but that won't remove it from the pool.

Am I on the right track? I know that this may seem easy to some of you but
I am in the last half of my second 44 hour workday in less than a week and
my brain is not working ;(

Any help is greately appreciated,

Leon



-------------------------------------------------------
This SF.Net email is sponsored by OSTG. Have you noticed the changes on
Linux.com, ITManagersJournal and NewsForge in the past few weeks? Now,
one more big change to announce. We are now OSTG- Open Source Technology
Group. Come see the changes on the new OSTG site. www.ostg.com
_______________________________________________
BackupPC-users mailing list
BackupPC-users < at > lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/backuppc-users
http://backuppc.sourceforge.net/

Post Search for and delete files from the pool 
On 08/06 10:29 , Leon Letto wrote:
I have a pool that is sitting at 100% with a gig or so free. Backuppc is
not running backups as it shouldn't. However, I would like to search the
backuppc data directory and delete any mp3, avi, etc. files that are in
there

# cd __TOPDIR__/pc/
# find . -name *.mp3
<you should see a list of your .mp3 files here. if it looks like a good list
(i.e. you didn't typo something that will be painful to fix), go to the next
step.>
# find . -name *.mp3 -exec rm -f {} \;

- and potentially - find all files that are bigger than 1 GB,

'find . -size n' only finds files of an exact size... I'm having a
brainfart here too. hmm.

I think I need to search for any files that end with the right extension (in
the pc directory) and then pipe the result to rm -f. Then I believe I need
to run BackupPC_Nightly to remove the orphaned files in the pool directory.

good thought, I would have missed that. Smile

--
Carl Soderstrom
Systems Administrator
Real-Time Enterprises
www.real-time.com


-------------------------------------------------------
This SF.Net email is sponsored by OSTG. Have you noticed the changes on
Linux.com, ITManagersJournal and NewsForge in the past few weeks? Now,
one more big change to announce. We are now OSTG- Open Source Technology
Group. Come see the changes on the new OSTG site. www.ostg.com
_______________________________________________
BackupPC-users mailing list
BackupPC-users < at > lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/backuppc-users
http://backuppc.sourceforge.net/

Post Search for and delete files from the pool 
On Fri, 6 Aug 2004 10:30:20 -0500, Carl Wilhelm Soderstrom
<chrome < at > real-time.com> wrote:
'find . -size n' only finds files of an exact size... I'm having a
brainfart here too. hmm.

`find . -size +n' will find all files greater than n, and -n will find
all files smaller. All numeric arguments to find can be specified in
this way.

--
Justin Guenther
IT Analyst
CrownAg International Inc.
250 Henderson Drive
Regina, SK, Canada S4N 5P7
Tel: (306) 522-8111
Email: justin.guenther < at > crownag.ca


-------------------------------------------------------
This SF.Net email is sponsored by OSTG. Have you noticed the changes on
Linux.com, ITManagersJournal and NewsForge in the past few weeks? Now,
one more big change to announce. We are now OSTG- Open Source Technology
Group. Come see the changes on the new OSTG site. www.ostg.com
_______________________________________________
BackupPC-users mailing list
BackupPC-users < at > lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/backuppc-users
http://backuppc.sourceforge.net/

Post Search for and delete files from the pool 
On 08/06 10:29 , Leon Letto wrote:
I have a pool that is sitting at 100% with a gig or so free. Backuppc is
not running backups as it shouldn't. However, I would like to search the
backuppc data directory and delete any mp3, avi, etc. files that are in
there

# cd __TOPDIR__/pc/
# find . -name *.mp3
<you should see a list of your .mp3 files here. if it looks like a good list
(i.e. you didn't typo something that will be painful to fix), go to the next
step.>
# find . -name *.mp3 -exec rm -f {} \;

using -exec is often the least efficient way to do this.

far preferable:
# find . -name *.mp3 | xargs rm -f

you can also often avoid running the find again -- if you have the
output on your screen, you can just copy and paste it into the
simple command "xargs rm -f".


- and potentially - find all files that are bigger than 1 GB,

'find . -size n' only finds files of an exact size... I'm having a
brainfart here too. hmm.

you want "find . -size +n" to do "greater than" -- i.e.
find . -size +1048576k

paul
=---------------------
paul fox, pgf < at > foxharp.boston.ma.us (arlington, ma, where it's 60.8 degrees)


-------------------------------------------------------
This SF.Net email is sponsored by OSTG. Have you noticed the changes on
Linux.com, ITManagersJournal and NewsForge in the past few weeks? Now,
one more big change to announce. We are now OSTG- Open Source Technology
Group. Come see the changes on the new OSTG site. www.ostg.com
_______________________________________________
BackupPC-users mailing list
BackupPC-users < at > lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/backuppc-users
http://backuppc.sourceforge.net/

Post Search for and delete files from the pool 
On 08/06 09:38 , Justin Guenther wrote:
On Fri, 6 Aug 2004 10:30:20 -0500, Carl Wilhelm Soderstrom
<chrome < at > real-time.com> wrote:
'find . -size n' only finds files of an exact size... I'm having a
brainfart here too. hmm.

`find . -size +n' will find all files greater than n, and -n will find
all files smaller. All numeric arguments to find can be specified in
this way.

ah, k. I was thinking along those lines, but didn't have any time to
experiment this morning. I'm used to using that syntax for permission
searches, like:

# find / -perm +4000

to find all the SUID programs on a system. (+2000 to search for SGID). the
man page spells it out a little more clearly for the '-perm' option.

find is just too flexible to be easily comprehended. Smile

--
Carl Soderstrom
Systems Administrator
Real-Time Enterprises
www.real-time.com


-------------------------------------------------------
This SF.Net email is sponsored by OSTG. Have you noticed the changes on
Linux.com, ITManagersJournal and NewsForge in the past few weeks? Now,
one more big change to announce. We are now OSTG- Open Source Technology
Group. Come see the changes on the new OSTG site. www.ostg.com
_______________________________________________
BackupPC-users mailing list
BackupPC-users < at > lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/backuppc-users
http://backuppc.sourceforge.net/

Post Search for and delete files from the pool 
On 08/06 11:43 , Paul Fox wrote:
# find . -name *.mp3 -exec rm -f {} \;

using -exec is often the least efficient way to do this.

far preferable:
# find . -name *.mp3 | xargs rm -f

I never understood that; tho I've heard it elsewhere. the command using
xargs uses 3 programs (find, xargs, rm); whereas the first command only uses
find and rm. So I'd think it would be faster to avoid using xargs.

Obviously, rm gets invoked once for each file; but I would think that it
would be the same number of external invocations either way.

what am I missing here?

--
Carl Soderstrom
Systems Administrator
Real-Time Enterprises
www.real-time.com


-------------------------------------------------------
This SF.Net email is sponsored by OSTG. Have you noticed the changes on
Linux.com, ITManagersJournal and NewsForge in the past few weeks? Now,
one more big change to announce. We are now OSTG- Open Source Technology
Group. Come see the changes on the new OSTG site. www.ostg.com
_______________________________________________
BackupPC-users mailing list
BackupPC-users < at > lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/backuppc-users
http://backuppc.sourceforge.net/

Post Search for and delete files from the pool 
Carl Wilhelm Soderstrom wrote:
On 08/06 11:43 , Paul Fox wrote:

# find . -name *.mp3 -exec rm -f {} \;

using -exec is often the least efficient way to do this.

far preferable:
# find . -name *.mp3 | xargs rm -f


I never understood that; tho I've heard it elsewhere. the command using
xargs uses 3 programs (find, xargs, rm); whereas the first command only uses
find and rm. So I'd think it would be faster to avoid using xargs.

Obviously, rm gets invoked once for each file; but I would think that it
would be the same number of external invocations either way.

what am I missing here?


xargs by default batches up the arguments to a command so in this case,
rm -f is sent not one, but a bunch of things to delete. If you do
something like this:

# find . -name *.mp3 | xargs -n1 rm -f

you'll get the same behavior as the find -exec. xargs will run rm for
each 1 argument it gets. The default for -n is much larger, my docs say
up 20k worth of chars in the command line but that probably varies with
the max size of you command line.


-------------------------------------------------------
This SF.Net email is sponsored by OSTG. Have you noticed the changes on
Linux.com, ITManagersJournal and NewsForge in the past few weeks? Now,
one more big change to announce. We are now OSTG- Open Source Technology
Group. Come see the changes on the new OSTG site. www.ostg.com
_______________________________________________
BackupPC-users mailing list
BackupPC-users < at > lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/backuppc-users
http://backuppc.sourceforge.net/

Post Search for and delete files from the pool 
# find . -name *.mp3 -exec rm -f {} \;

using -exec is often the least efficient way to do this.

far preferable:
# find . -name *.mp3 | xargs rm -f

I never understood that; tho I've heard it elsewhere. the command using
xargs uses 3 programs (find, xargs, rm); whereas the first command only uses
find and rm. So I'd think it would be faster to avoid using xargs.

Obviously, rm gets invoked once for each file; but I would think that it
would be the same number of external invocations either way.

what am I missing here?

in the usual case, xargs only invokes rm once, giving a total of
exactly three processes.

suppose that find returns:
./a
./b
./c/d

then xargs will run:
rm -f ./a ./b ./c/d

the only time rm will be run more than once is if the maximum
argument list length is exceeded (usually many thousands of arguments),
and then it will automatically run that rm, and start accumulating
args for a new invocation.

you can tell xargs to invoke the command with a smaller number of
args -- i forget how at the moment.

paul
=---------------------
paul fox, pgf < at > foxharp.boston.ma.us (arlington, ma, where it's 62.2 degrees)


-------------------------------------------------------
This SF.Net email is sponsored by OSTG. Have you noticed the changes on
Linux.com, ITManagersJournal and NewsForge in the past few weeks? Now,
one more big change to announce. We are now OSTG- Open Source Technology
Group. Come see the changes on the new OSTG site. www.ostg.com
_______________________________________________
BackupPC-users mailing list
BackupPC-users < at > lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/backuppc-users
http://backuppc.sourceforge.net/

Post Search for and delete files from the pool 
On 08/06 12:33 , Marc Prewitt wrote:
what am I missing here?


xargs by default batches up the arguments to a command

ah, ok. makes sense.

--
Carl Soderstrom
Systems Administrator
Real-Time Enterprises
www.real-time.com


-------------------------------------------------------
This SF.Net email is sponsored by OSTG. Have you noticed the changes on
Linux.com, ITManagersJournal and NewsForge in the past few weeks? Now,
one more big change to announce. We are now OSTG- Open Source Technology
Group. Come see the changes on the new OSTG site. www.ostg.com
_______________________________________________
BackupPC-users mailing list
BackupPC-users < at > lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/backuppc-users
http://backuppc.sourceforge.net/

Post Search for and delete files from the pool 
That worked great. I had to add another couple of parameters "find . -name
*.mp3 -print0 | xargs -0 rm -f". The options -print0 on find and -0 on
xargs tell them to use the ascii 0 or null character as a delimiter
otherwise you fight with "xargs: unmatched single quote" if your filenames
contain single quotes.


Leon

-----Original Message-----
From: Paul Fox [mailto:pgf < at > foxharp.boston.ma.us]
Sent: Friday, August 06, 2004 11:44 AM
To: backuppc-users < at > lists.sourceforge.net
Subject: Re: [BackupPC-users] Search for and delete files from the pool

On 08/06 10:29 , Leon Letto wrote:
I have a pool that is sitting at 100% with a gig or so free. Backuppc
is > > not running backups as it shouldn't. However, I would like to
search the > > backuppc data directory and delete any mp3, avi, etc. files
that are in > > there > > # cd __TOPDIR__/pc/ > # find . -name *.mp3 >
<you should see a list of your .mp3 files here. if it looks like a good list
(i.e. you didn't typo something that will be painful to fix), go to the
next > step.> > # find . -name *.mp3 -exec rm -f {} \;

using -exec is often the least efficient way to do this.

far preferable:
# find . -name *.mp3 | xargs rm -f

you can also often avoid running the find again -- if you have the output on
your screen, you can just copy and paste it into the simple command "xargs
rm -f".


- and potentially - find all files that are bigger than 1 GB, > >
'find . -size n' only finds files of an exact size... I'm having a >
brainfart here too. hmm.

you want "find . -size +n" to do "greater than" -- i.e.
find . -size +1048576k

paul
=---------------------
paul fox, pgf < at > foxharp.boston.ma.us (arlington, ma, where it's 60.8 degrees)


-------------------------------------------------------
This SF.Net email is sponsored by OSTG. Have you noticed the changes on
Linux.com, ITManagersJournal and NewsForge in the past few weeks? Now, one
more big change to announce. We are now OSTG- Open Source Technology Group.
Come see the changes on the new OSTG site. www.ostg.com
_______________________________________________
BackupPC-users mailing list
BackupPC-users < at > lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/backuppc-users
http://backuppc.sourceforge.net/


-------------------------------------------------------
This SF.Net email is sponsored by OSTG. Have you noticed the changes on
Linux.com, ITManagersJournal and NewsForge in the past few weeks? Now,
one more big change to announce. We are now OSTG- Open Source Technology
Group. Come see the changes on the new OSTG site. www.ostg.com
_______________________________________________
BackupPC-users mailing list
BackupPC-users < at > lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/backuppc-users
http://backuppc.sourceforge.net/

Post Search for and delete files from the pool 
great -- thanks for pointing out the -print0/-0 trick. i've had
that problem with xargs before...

paul

That worked great. I had to add another couple of parameters "find . -name
*.mp3 -print0 | xargs -0 rm -f". The options -print0 on find and -0 on
xargs tell them to use the ascii 0 or null character as a delimiter
otherwise you fight with "xargs: unmatched single quote" if your filenames
contain single quotes.


far preferable:
# find . -name *.mp3 | xargs rm -f


=---------------------
paul fox, pgf < at > foxharp.boston.ma.us (arlington, ma, where it's 73.8 degrees)


-------------------------------------------------------
This SF.Net email is sponsored by OSTG. Have you noticed the changes on
Linux.com, ITManagersJournal and NewsForge in the past few weeks? Now,
one more big change to announce. We are now OSTG- Open Source Technology
Group. Come see the changes on the new OSTG site. www.ostg.com
_______________________________________________
BackupPC-users mailing list
BackupPC-users < at > lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/backuppc-users
http://backuppc.sourceforge.net/

Display posts from previous:
Reply to topic Page 1 of 1
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
  


Magic SEO URL for phpBB