command for recently modified files - "find" command not working


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users command for recently modified files - "find" command not working
# 1  
Old 08-13-2010
command for recently modified files - "find" command not working

I have three files a.txt , b.txt , c.txt in a directory called my_dir1 .These files were created before two or three months . I have a tar file called my_tar1.tar which contains three files a.txt , b.txt , d.txt . Somebody untarred the my_tar1.tar into my_dir1 directory. So existing two files were replaced .Untarred files shows the date when the files were tarred . A new file called d.txt is there in my_dir1 . The file d.txt also shows the date when it was tarred. 'find' command is not helping to list out the recently modified files. Because files contains tarred dates. is there any command , which can list the recently modified files irrespective of dates ?

Before untarring :
Code:
total 0
-rwxrwxrwx   1 user1 pcfd         100 Feb 13 10:29 a.txt
-rwxrwxrwx   1 user1 pcfd         150 Feb 13 10:29 b.txt
-rwxrwxrwx   1 user1 pcfd         117 Feb 13 10:29 c.txt

After untarring my_tar1.tar

Code:
total 0
-rwxrwxrwx   1 user1 pcfd         120 Jan 13 10:29 a.txt
-rwxrwxrwx   1 user1 pcfd         130 Jan 13 10:29 b.txt
-rwxrwxrwx   1 user1 pcfd         117 Feb 13 10:29 c.txt
-rwxrwxrwx   1 user1 pcfd         110 Jan 13 10:29 d.txt


Expected Resulut:
Code:
-rwxrwxrwx   1 user1 pcfd         120 Jan 13 10:29 a.txt
-rwxrwxrwx   1 user1 pcfd         130 Jan 13 10:29 b.txt
-rwxrwxrwx   1 user1 pcfd         110 Jan 13 10:29 d.txt

Moderator's Comments:
Mod Comment Use code tags please, ty.

Last edited by zaxxon; 08-13-2010 at 11:54 AM..
# 2  
Old 08-16-2010
You can use the -ctime option of the find command. The ctime refers to the moment, the inode of a file was changed.

Code:
find my_dir1 -type f -ctime -10

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. AIX

Apache 2.4 directory cannot display "Last modified" "Size" "Description"

Hi 2 all, i have had AIX 7.2 :/# /usr/IBMAHS/bin/apachectl -v Server version: Apache/2.4.12 (Unix) Server built: May 25 2015 04:58:27 :/#:/# /usr/IBMAHS/bin/apachectl -M Loaded Modules: core_module (static) so_module (static) http_module (static) mpm_worker_module (static) ... (3 Replies)
Discussion started by: penchev
3 Replies

2. Shell Programming and Scripting

Using sed command to replace "|" with ^ for all *.dat files in a folder not working

I am trying to use the below sed command to replace all "|" to ^, in a folder had 50 dat files. when i tried with 1 file it worked but when i tried with wild card, is not working. sed -i 's/"|"/\^/g' *.dat Is this the proper way to use sed command thank you very much for help. (3 Replies)
Discussion started by: cplusplus1
3 Replies

3. UNIX for Dummies Questions & Answers

Using "mailx" command to read "to" and "cc" email addreses from input file

How to use "mailx" command to do e-mail reading the input file containing email address, where column 1 has name and column 2 containing “To” e-mail address and column 3 contains “cc” e-mail address to include with same email. Sample input file, email.txt Below is an sample code where... (2 Replies)
Discussion started by: asjaiswal
2 Replies

4. Shell Programming and Scripting

Short command to create two files >{respo,nd}.php (with "tee" command?)

08:29 < xsi> >{respo,nd}.php bash: {respo,nd}.php: ambiguous redirect 08:31 < geirha> xsi: maybe you want tee So I was advised to do so. And I can't create two OR MORE files at once with {a,b,c,d,e,f}.php (which I quickly now need to create and to learn to create in the future to quickly... (2 Replies)
Discussion started by: Xcislav
2 Replies

5. Shell Programming and Scripting

Problem with "find" and "grep" command

I want to list all files/lines which except those which contain the pattern ' /proc/' OR ' /sys/' (mind the leading blank). In a first approach I coded: find / -exec ls -ld {} | grep -v ' /proc/| /sys/' \; > /tmp/list.txt But this doesn't work. I got an error (under Ubuntu): grep:... (5 Replies)
Discussion started by: pstein
5 Replies

6. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

7. Shell Programming and Scripting

"find command" to find the files in the current directories but not in the "subdir"

Dear friends, please tell me how to find the files which are existing in the current directory, but it sholud not search in the sub directories.. it is like this, current directory contains file1, file2, file3, dir1, dir2 and dir1 conatins file4, file5 and dir2 contains file6,... (9 Replies)
Discussion started by: swamymns
9 Replies

8. UNIX for Dummies Questions & Answers

chmod command for recently modified files

hello! is there a way for me to use the chmod command to change permissions for several files all at once -based on the fact that these files were all most recently modified TODAY ? I can't use a wildcard on their filenames because the filenames are varied. But I was hoping I could somehow do... (2 Replies)
Discussion started by: polka_friend
2 Replies

9. UNIX for Dummies Questions & Answers

Listing only directories in the current working directory using the "ls" command

Hello All, I am trying to list only directories in my current directory using the command "ls -d". But the output only contains the default directory "." and doesn't list the rest of the directories in the working directory. Can anyone explain why this is happening (2 Replies)
Discussion started by: igandu
2 Replies

10. UNIX for Dummies Questions & Answers

How to find out the exact year in "Last modified time" using ls command

Hi, I understand that the ls command with "-l" option generates the "last modified time" of specific directory. However, some generated results displayed the "last modified time" with detail about the last modified year, for example: -rwxrwxrwx+ 1 smith dev 10876 May 16 2005 part2 ... (6 Replies)
Discussion started by: Dophlinne
6 Replies
Login or Register to Ask a Question