Solved

tar with --newer-mtime includes all the directories

Posted on 2014-02-14
2
667 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 findtar. 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

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This is the error message I got (CODE) Error caused by incompatible libmp3lame 3.98-2 with ffmpeg I've googled this error message and found out sometimes it attaches this note "can be treated with downgrade libmp3lame to version 3.97 or 3.98" …
The purpose of this article is to demonstrate how we can use conditional statements using Python.
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

776 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