Well, you're 99% of the way there.
Using your
find command, which is giving you a list (forget about the
-exec ls -la {} \; part, you don't need it for what you want to do), simply use
find to get a list of files in a temporary file (say,
/tmp/filelist or something). That would be
Code:
find <path-to-direcoty> -mtime +1 > /tmp/filelist
Then, create your
tar archive
Code:
cat /tmp/filelist | tar -cvf filelist.tar -
Then, use the same list to remove the files
Code:
rm `cat /tmp/fielist`
Just in case the list of file is quite large, you can use
find to do that instead (and here's where you can use
-exec)
Code:
find <path-to-direcoty> -mtime +1 > /tmp/filelist -exec rm {} \;
or you could use
xargs
Code:
cat /tmp/filelist | xargs rm
Finally, remove the temporary file
Wrap that up pretty in a shell program and
viola!
Hope this helps some.