Tar and --newer / -after-date options

My project structure is as follows:

-sprint41
 -file1
 -file2
-sprint40
 -file1
 -file2
  • All my files (+ sprint41) in the sprint41 folder have a modified date 20130807
  • All my files (+ sprint40) in the sprint40 folder have a modified date 20130610

I want to create an archive containing all the files (+ folder) after 20130715. My command is as follows:

tar -cf test.tar --after-date 20130715 *

After this command, test.tar contains the following:

-sprint41
 -file1
 -file2
-sprint40

It saves the sprint40 folder even if the modified date is before 20130715

I expect the following:

-sprint41
 -file1
 -file2

Do you have a key?

Many thanks

+1
source share
1 answer

, , tar , . -newer , . script, find -cnewer tar ( --no-recursion on tar command).

,

 touch -t 201307150000 timefile.txt

Somthing like:

find . -cnewer timefile.txt -print0 | xargs -0 tar --no-recursion -cf test.tar
+1

Source: https://habr.com/ru/post/1758568/


All Articles