Re: [gentoo-user] Any way around Argument list too long?

2011-07-20 Thread Joost Roeleveld
Top-posting IMPORTANT NOTE ON TOP Do NOT create the file I mention below unless you WANT to risk deleting ALL your files. On Tuesday 19 July 2011 15:58:44 Florian Philipp wrote: The double dash will prevent mv from interpreting weird file names like -h as parameters. Just about every standard

Re: [gentoo-user] Any way around Argument list too long?

2011-07-19 Thread Florian Philipp
Am 18.07.2011 10:48, schrieb Neil Bothwick: On Sun, 17 Jul 2011 18:40:44 -0700, Grant wrote: Alright, find is tricky. Is this the right spot for -delete? /usr/bin/find /home/user -type f -name *-`/bin/date -d 'yesterday' +\%Y\%m\%d`*.jpg - delete Yes, but if you don't want irreversible

Re: [gentoo-user] Any way around Argument list too long?

2011-07-19 Thread Neil Bothwick
On Tue, 19 Jul 2011 15:58:44 +0200, Florian Philipp wrote: In all these commands it would always be a good idea to deactivate parameter parsing just in front of the place where the file names are inserted. Very good point! -- Neil Bothwick This is the day for firm decisions! Or is it?

Re: [gentoo-user] Any way around Argument list too long?

2011-07-19 Thread Grant
Alright, find is tricky.  Is this the right spot for -delete? /usr/bin/find /home/user -type f -name *-`/bin/date -d 'yesterday' +\%Y\%m\%d`*.jpg - delete Yes, but if you don't want irreversible mistakes, move the files instead. find /home/user -type f -name blah -exec mv -t ~/.Trashcan {}

Re: [gentoo-user] Any way around Argument list too long?

2011-07-19 Thread David W Noon
On Tue, 19 Jul 2011 11:24:55 -0700, Grant wrote about Re: [gentoo-user] Any way around Argument list too long?: [snip] The double dash will prevent mv from interpreting weird file names like -h as parameters. Just about every standard GNU tool supports this. Does that apply to a command

Re: [gentoo-user] Any way around Argument list too long?

2011-07-18 Thread Neil Bothwick
On Sun, 17 Jul 2011 18:40:44 -0700, Grant wrote: Alright, find is tricky. Is this the right spot for -delete? /usr/bin/find /home/user -type f -name *-`/bin/date -d 'yesterday' +\%Y\%m\%d`*.jpg - delete Yes, but if you don't want irreversible mistakes, move the files instead. find

Re: [gentoo-user] Any way around Argument list too long?

2011-07-18 Thread Grant
Alright, find is tricky.  Is this the right spot for -delete? /usr/bin/find /home/user -type f -name *-`/bin/date -d 'yesterday' +\%Y\%m\%d`*.jpg - delete Yes, but if you don't want irreversible mistakes, move the files instead. find /home/user -type f -name blah -exec mv -t ~/.Trashcan {}

Re: [gentoo-user] Any way around Argument list too long?

2011-07-17 Thread Alan Mackenzie
Hi, Grant. On Sun, Jul 17, 2011 at 12:32:42PM -0700, Grant wrote: My crontab deletes all files of a certain type in a certain folder with yesterday's date in the filename. It usually executes but sometimes fails with: /bin/rm: Argument list too long What would you do about this? Use

Re: [gentoo-user] Any way around Argument list too long?

2011-07-17 Thread victor romanchuk
it could be slightly less efficient comparing to plain `rm', but worked around your problem: find your-dir -ctime -1 -exec rm {} \; basically `find' has a lot options filtering result set. these include time/date, file name (regexp), file type and so on. consult man for details victor Grant

Re: [gentoo-user] Any way around Argument list too long?

2011-07-17 Thread David W Noon
On Sun, 17 Jul 2011 12:32:42 -0700, Grant wrote about [gentoo-user] Any way around Argument list too long?: My crontab deletes all files of a certain type in a certain folder with yesterday's date in the filename. It usually executes but sometimes fails with: /bin/rm: Argument list too

RE: [gentoo-user] Any way around Argument list too long?

2011-07-17 Thread Pandu Poluan
-original message- Subject: Re: [gentoo-user] Any way around Argument list too long? From: Alan Mackenzie a...@muc.de Date: 2011-07-18 02:42 Hi, Grant. On Sun, Jul 17, 2011 at 12:32:42PM -0700, Grant wrote: My crontab deletes all files of a certain type in a certain folder with yesterday's

Re: [gentoo-user] Any way around Argument list too long?

2011-07-17 Thread Alan McKinnon
Are you using wildcards in the arguments to rm ? Rather use find | xargs or find -exec which are designed to deal with exactly this circumstance. On 17 Jul 2011 9:32 PM, Grant emailgr...@gmail.com wrote: My crontab deletes all files of a certain type in a certain folder with yesterday's date in

Re: [gentoo-user] Any way around Argument list too long?

2011-07-17 Thread Michael Mol
On Sun, Jul 17, 2011 at 3:54 PM, Pandu Poluan pa...@poluan.info wrote: -original message- Subject: Re: [gentoo-user] Any way around Argument list too long? From: Alan Mackenzie a...@muc.de Date: 2011-07-18 02:42 Hi, Grant. On Sun, Jul 17, 2011 at 12:32:42PM -0700, Grant wrote: My crontab

Re: [gentoo-user] Any way around Argument list too long?

2011-07-17 Thread Grant
way around Argument list too long?: My crontab deletes all files of a certain type in a certain folder with yesterday's date in the filename.  It usually executes but sometimes fails with: /bin/rm: Argument list too long What would you do about this? Use find with the -delete option.

Re: [gentoo-user] Any way around Argument list too long?

2011-07-17 Thread Michael Mol
On Sun, Jul 17, 2011 at 7:23 PM, Grant emailgr...@gmail.com wrote: I'm getting the same thing from find: $ /usr/bin/find /home/user/*-`/bin/date -d 'yesterday' +\%Y\%m\%d`*.jpg /usr/bin/find: Argument list too long You're using find wrong; the first argument needs to be the root path it

Re: [gentoo-user] Any way around Argument list too long?

2011-07-17 Thread Alan McKinnon
On Sunday 17 July 2011 16:23:54 Grant did opine thusly: way around Argument list too long?: My crontab deletes all files of a certain type in a certain folder with yesterday's date in the filename. It usually executes but sometimes fails with: /bin/rm: Argument list too long

Re: [gentoo-user] Any way around Argument list too long?

2011-07-17 Thread Grant
You are doing it wrong. Each command has something between ``, so bash is expanding that entire list and just before feeding the whole lot to find, realizes that the list is longer than 65,536 characters. It's bash that is returning that error, not find. You're mistake is trying to marrow

Re: [gentoo-user] Any way around Argument list too long?

2011-07-17 Thread Albert Hopkins
On Sunday, July 17 at 17:47 (-0700), Grant said: ran this and the output was voluminous but looked good: /usr/bin/find /home/user -type f -name *-`/bin/date -d 'yesterday' +\%Y\%m\%d`*.jpg So I ran it again, adding -delete right before -type. After a lot of

Re: [gentoo-user] Any way around Argument list too long?

2011-07-17 Thread Grant
ran this and the output was voluminous but looked good: /usr/bin/find /home/user -type f -name *-`/bin/date -d 'yesterday' +\%Y\%m\%d`*.jpg So I ran it again, adding -delete right before -type.  After a lot of   That was a mistake.