perl -e 'chdir "/var/session" or die; opendir D, ".";
while ($f = readdir D) { unlink $f }'
It is very efficient memory-wise compared to the other options as well as being much faster.
It is also easy to apply filters as you would with -mtime or such in find, just change the end statement to:
It's not that I'd use Perl for the task, just that I don't think rsync is special. Indeed, rsync has the overhead of forking a child and communicating empty/'s bareness.
Comments
I use perl for this as well.
It is very efficient memory-wise compared to the other options as well as being much faster. It is also easy to apply filters as you would with -mtime or such in find, just change the end statement to: to affect files modified more than 30 days ago.It's not that I'd use Perl for the task, just that I don't think rsync is special. Indeed, rsync has the overhead of forking a child and communicating empty/'s bareness.