Solved

tar with --newer-mtime includes all the directories

Posted on 2014-02-14
2
716 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

If you have a server on collocation with the super-fast CPU, that doesn't mean that you get it running at full power. Here is a preamble. When doing inventory of Linux servers, that I'm administering, I've found that some of them are running on l…
SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
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.:
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.

707 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