Find files older than x days and create a consolidated single tar file.

Hello,

I need help in finding files older than x days and creating a single consolidated tar file combining them. Can anyone please provide me a script?

Thanks,
Dawn

hi

find /your_directory -mtime +2 -exec ls -l {}\ ;
List files older than 2 days.

Hi,

I'm aware of this command but the output results in 100s of files. Any suggestions as how to tar these?

Thanks

Try this:

You can try like:

find directory -name "*.log" -type f -mtime +2   | xargs tar -cvf a.tar -

This will search for files with ext .log which are older than 2 days and will make a tar "a.tar"