Script to gather all the files ending in .log and create a tar.gz file.
Posted
by
Oscar Reyes
on Server Fault
See other posts from Server Fault
or by Oscar Reyes
Published on 2011-01-03T17:18:04Z
Indexed on
2011/01/03
17:55 UTC
Read the original article
Hit count: 266
I'm currently using this script line to find all the log files from a given directory structure and copy them to another directy where I can easily compress them.
find . -name "*.log" -exec cp \{\} /tmp/allLogs/ \;
The problem I have, is, the directory/subdirectory information gets lost because, I'm copying only the file.
For instance I have:
./product/install/install.log
./product/execution/daily.log
./other/conf/blah.log
And I end up with:
/tmp/allLogs/install.log
/tmp/allLogs/daily.log
/tmp/allLogs/blah.log
And I would like to have:
/tmp/allLogs/product/install/install.log
/tmp/allLogs/product/execution/daily.log
/tmp/allLogs/other/conf/blah.log
© Server Fault or respective owner