Tar with particular date files


 
Thread Tools Search this Thread
Operating Systems Linux Red Hat Tar with particular date files
# 1  
Old 06-17-2013
Tar with particular date files

I need to find out only Jun 10 created and modified file with tar command ,, I am using Linux red hat x86_64 GNU/Linux.

Code:
ls -lrt

-rw-r--r-- 1 nova nova    2757 Jun  7 11:00 feed.ctl
-rwxrwxr-x 1 nova nova     457 Jun  7 11:00 acc_feed.csh
-rwxr-xr-x 1 nova nova     473 Jun  7 12:11 acc_feed_d2.csh
-rwxr-xr-x 1 nova nova     937 Jun 10 11:28 minus_1.csh
-rwxr-x--- 1 nova nova    1758 Jun 10 12:15 reject_ld.csh
-rwxr-x--- 1 nova nova    2019 Jun 10 12:18 reject_ld2.ctl
-rwxr-xr-x 1 nova nova     979 Jun 10 13:34 stg_2.csh
-rwxr-xr-x 1 nova nova     855 Jun 10 09:12 mspool.csh


tar output file should have below files..
Please help me to find out the 1 line Linux command , Thanks in advance...

Last edited by Scott; 06-18-2013 at 06:26 AM.. Reason: Code tags
# 2  
Old 06-18-2013
make sure you support Unix.com and one of your local charities ...
Code:
tar -cf /dir/file.tar $(ls -l | grep "Jun 10" | awk '{print $NF}')

# 3  
Old 07-14-2013
thank you so much for your help , need to tar file based on from and to date and time.


ls -lrt
-rw-r--r-- 1 nova nova 2757 Jun 7 11:00 feed.ctl
-rwxrwxr-x 1 nova nova 457 Jun 7 11:00 acc_feed.csh
-rwxr-xr-x 1 nova nova 473 Jun 7 12:11 acc_feed_d2.csh
-rwxr-xr-x 1 nova nova 937 Jun 10 11:28 minus_1.csh
-rwxr-x--- 1 nova nova 1758 Jun 10 12:15 reject_ld.csh
-rwxr-x--- 1 nova nova 2019 Jun 10 12:18 reject_ld2.ctl
-rwxr-xr-x 1 nova nova 979 Jun 10 13:34 stg_2.csh
-rwxr-xr-x 1 nova nova 855 Jun 10 09:12 mspool.csh


need to tar a file between Jun 7, 11:00 and Jun 10, 12:18.

we use csh shell on linix os . thanks in advance.

---------- Post updated at 05:14 AM ---------- Previous update was at 03:02 AM ----------

basically i need from datetime and to date_date tar file .
please do the needful. thanks.

Last edited by Scott; 07-14-2013 at 08:18 AM.. Reason: We don't 'do the needful' for anyone who shows no effort, and can't follow simple forum rules
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Tar with variable date in separate shell

Hi, I am trying to Zip a folder inside a shell script like below. It successfully taring but it only returns Null inside the variables. Searched a lot but no clue to finding the root cause. testno=1; date=20171128; DIR=/root/ sh -c 'cd $DIR; tar cvf "AWS.${testno.${date}.tar" "./AWS"' ... (5 Replies)
Discussion started by: pradyumnajpn10
5 Replies

2. Shell Programming and Scripting

How to list files that are not first two files date & last file date for every month-year?

Hi All, I need to find all files other than first two files dates & last file date for month and month/year wise list. lets say there are following files in directory Mar 19 2012 c.txt Mar 19 2012 cc.txt Mar 21 2012 d.txt Mar 22 2012 f.txt Mar 24 2012 h.txt Mar 25 2012 w.txt Feb 12... (2 Replies)
Discussion started by: Makarand Dodmis
2 Replies

3. Shell Programming and Scripting

Need help to tar and gzip files per date

hi, I have multiple files created per date every day. I want to be able to tar all the files older than 7 days into a single file and then gzip that tarred file and move it to a separate partition. Then delete the actual files. Eg - "ls -l" shows Dec 8 has 6-8 files created. I want to tar... (4 Replies)
Discussion started by: vishal7
4 Replies

4. 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

5. UNIX for Dummies Questions & Answers

how to tar with date criteria?

I would like to tar (compress) all the files with some date criteria. I tried : tar -cvwf 20_08_2010.tar | ls -la | grep "Aug 20" but it's not working. How should I type? (3 Replies)
Discussion started by: bongo
3 Replies

6. Shell Programming and Scripting

tar files by date

Hi, I have a solaris 10, I would like to tar log files by date, or by range of hours into one tar file. All I coud do is by name (very simple...:cool:). (4 Replies)
Discussion started by: pointer
4 Replies

7. 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

8. Shell Programming and Scripting

Sorting Files by date and moving files in date order

I need to build a k shell script that will sort files in a directory where files appear like this "XXXX_2008021213.DAT. I need to sort by date in the filename and then move files by individual date to a working folder. concatenate the files in the working folder then start a process once... (2 Replies)
Discussion started by: rebel64
2 Replies

9. UNIX for Advanced & Expert Users

Untaring *.tar.tar files

Hi all, How to untar a file with .tar.tar extension. A utility that i downloaded from net had this extension. Thanks in advance, bubeshj. (6 Replies)
Discussion started by: bubeshj
6 Replies

10. UNIX for Dummies Questions & Answers

tar archive: time, date?

Is there a way to know when (date, time) a tar archive on tape was created? (1 Reply)
Discussion started by: croy75
1 Replies
Login or Register to Ask a Question