Solved

tar with --newer-mtime includes all the directories

Posted on 2014-02-14
2
645 Views
Last Modified: 2014-02-15
hello, each night i am running the command

/bin/tar cfz $TARFILENAME --newer-mtime=\"$yesterday 00:00:01-06:00\" /home

Open in new window


It is finding and adding all the files modified OK, but also adding every directory. For my system that is over a GIG and yet total modified files are only a couple 100MB

I looked at the doc and there wasn't anything that jumped out.  tar --incremental will not work in my situation

thanks for any suggestions/help
0
Comment
Question by:paries
2 Comments
 
LVL 34

Accepted Solution

by:
Duncan Roe earned 500 total points
ID: 39860915
I think it's inherent in the way tar works. It dumps each directory as it comes to it and then applies the selection criterion to each non-directory file system object therein.
However you can accomplish what you want with a combination of find & tar. find's newerXY test can implement the date spec you use
find /home -newermt "yesterday 00:00:01-06:00" -not -type d | tar -T- -czf $TARFILENAME

Open in new window

Be sure to specify -not -type d or it may find /work for example
0
 
LVL 40

Expert Comment

by:omarfarid
ID: 39861280
I think it is looking for modification time of the dir which could be true if any file is added / removed.

find option given above is good for finding all files modified and then adding to tar.
0

Featured Post

Get up to 2TB FREE CLOUD per backup license!

An exclusive Black Friday offer just for Expert Exchange audience! Buy any of our top-rated backup solutions & get up to 2TB free cloud per system! Perform local & cloud backup in the same step, and restore instantly—anytime, anywhere. Grab this deal now before it disappears!

Join & Write a Comment

Currently, there is not an RPM package available under the RHEL/Fedora/CentOS distributions that gives you a quick and easy way to allow PHP to interface with Oracle. As a result, I have included a set of instructions on how to do this with minimal …
Introduction We as admins face situation where we need to redirect websites to another. This may be required as a part of an upgrade keeping the old URL but website should be served from new URL. This document would brief you on different ways ca…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now