Sponsored Content
Full Discussion: Tar creating copies of files
Top Forums Shell Programming and Scripting Tar creating copies of files Post 302673779 by Vryali on Wednesday 18th of July 2012 11:36:46 AM
Old 07-18-2012
Code:
find . -type d -newermt 2012-06-01 ! -newermt 2012-06-30 | tar -zcvf tar.tar.gz

Pretty sure you're having a problem because you aren't using an or or and in y our find, but I'm not 100% sure.

My test (I don't have the same find flags you do):

Code:
$ touch --date "2010-01-05" /tmp/old.foo
$ touch --date "2010-01-01" /tmp/older.foo
$ touch --date "2010-01-03" ./sub_dir/test.txt 
$ touch --date "2010-01-03" ./sub_dir/test.txt
$ find . \! -newer /tmp/old.foo -a -newer /tmp/older.foo -print
./sub_dir/test.txt
$ find . \! -newer /tmp/old.foo -a -newer /tmp/older.foo -exec tar -zcvf tartest.tar.gz {} \;
./sub_dir/test.txt

works as expected. Note the -a for the 'and' conditional.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

extract tar files without creating directory

I received a tar file of a directory with 50,000 files in it. Is it possible to extract the files in the tar file without first creating the directory? ie. Doing tar -xvf filename.tar extracts as follows: x directory/file1.txt x directory/file2.txt . . . I would like to avoid... (4 Replies)
Discussion started by: here2learn
4 Replies

2. UNIX for Advanced & Expert Users

How to create a Tar of multiple Files in Unix and FTP the tar to Windows.

Hi, On my Unix Server in my directory, I have 70 files distributed in the following directories (which have several other files too). These files include C Source Files, Shell Script Source Files, Binary Files, Object Files. a) /usr/users/oracle/bin b) /usr/users/oracle... (1 Reply)
Discussion started by: marconi
1 Replies

3. Shell Programming and Scripting

Creating tar excluding links

hi, How do i create a tar file of a directory excluding the links in that particular directory and its sub-directories. The below command doesnt work for me. tar -cvf abc.tar /dir1 --exclude"^l" (1 Reply)
Discussion started by: yesmani
1 Replies

4. OS X (Apple)

Terminal.app keeps creating copies of my settings files

Under Leopard, I like to conveniently open Terminal windows onto remote systems. I've created several settings files in Terminal, one for each remote system that I want to access. To open window, I right-click on the Terminal icon in the Dock, expand the "New Window" menu item, and select the... (0 Replies)
Discussion started by: siemsen
0 Replies

5. UNIX for Dummies Questions & Answers

Creating a Tar file while files are spooling

Hi I have done a search for this but couldn't find much on it. I am creating a tar file with the command below tar cvf /export/home/user/backup/*Will this is being created I have a job spooling to 5 texts files in the following directory /export/home/user/backup/STATS/ The tar files... (1 Reply)
Discussion started by: sgarvan
1 Replies

6. Solaris

How to extract files from a tar file without creating the directories?

Hello all. I have a tar file that contains a number of files that are stored in different directories. If I extract this tar file with -xvf , the directories get created. Is there a way to extract all of the files into one directory without creating the directories stored in the tar file. (9 Replies)
Discussion started by: gkb
9 Replies

7. Shell Programming and Scripting

tar command to explore multiple layers of tar and tar.gz files

Hi all, I have a tar file and inside that tar file is a folder with additional tar.gz files. What I want to do is look inside the first tar file and then find the second tar file I'm looking for, look inside that tar.gz file to find a certain directory. I'm encountering issues by trying to... (1 Reply)
Discussion started by: bashnewbee
1 Replies

8. UNIX for Dummies Questions & Answers

Creating a TAR

Hello , I have a unix script to create a TAR which is invoked from Mainframe job. #!/bin/ksh echo "Start Time : " $(date +%m-%d.%H.%M.%S) echo "*************************" tdate=$(date +_%m%d_%H%M%S) cmdfil="/usr/lpp/web-data/mfg/nct/file-data/ftpcmd.dat"... (6 Replies)
Discussion started by: gayathrivm
6 Replies

9. Windows & DOS: Issues & Discussions

[SOLVED] Creating .tar file

Hi, How to create a .tar file in windows OS.. I need to ftp tat <filename>.tar file into AIX and untar it there and will use for futher actions.. Please help.. Thanks in advance.. (2 Replies)
Discussion started by: Priya Amaresh
2 Replies

10. UNIX for Dummies Questions & Answers

Finding copies of files

theres a situation i'm dealing with where i feel like folks are stealing some of my files. they copy it (because they have complete sudo root access like i do) from my home directory and they copy it wherever and then change the name of the file so i wont know that they have it. is there a way... (1 Reply)
Discussion started by: SkySmart
1 Replies
Jifty::Manual::Style(3pm)				User Contributed Perl Documentation				 Jifty::Manual::Style(3pm)

NAME
Jifty::Manual::Style - Jifty coding style guide Default style When in doubt, default to whatever Damian Conway's Perl Best Practices says. Private documentation When documenting a private method, or providing documentation which is not useful to the user of the module (and is presumably useful to the developer), wrap it in =begin/end private. This way it does not show up in perldoc where a user would see it and yet is still available and well formatted (that is, not just a lump comment) when looking at the code. =begin private =head2 import_extra Called by L<Test::More>'s C<import> code when L<Jifty::Test> is first C<use>'d, it calls L</setup>, and asks Test::More to export its symbols to the namespace that C<use>'d this one. =end private sub import_extra { ... } Test temp files Files created by tests should be declared as such using Jifty::Test->test_file() so they are cleaned up on a successful test run. Use Shell::Command Shell::Command has a number of functions which work like common shell file commands such as "touch", "cp" and "mv". They are battle tested and cross-platform. Use them instead of coding your own. For example, instead of this: open my $file, ">foo"; close $file; Do this: use Shell::Command; touch $file; Case insensitive matching To check if a string equals another string case insensitively, do this lc $foo eq lc $bar; lc $foo eq 'bar'; not this: $foo =~ /^Q$barE/i; $foo =~ /^bar$/i; perl v5.14.2 2010-12-08 Jifty::Manual::Style(3pm)
All times are GMT -4. The time now is 10:51 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy