Solved

tar with --newer-mtime includes all the directories

Posted on 2014-02-14
2
677 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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
how can I get powershell to show the history of commands used ? 10 65
CENTOS DHCP Server / PXE/TFTP 14 150
Recover Lacie Edmini data. 11 48
Disabling security updates Ubuntu 3 24
Network Interface Card (NIC) bonding, also known as link aggregation, NIC teaming and trunking, is an important concept to understand and implement in any environment where high availability is of concern. Using this feature, a server administrator …
It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
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.

791 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