Confusing find command option


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Confusing find command option
# 1  
Old 03-29-2011
Confusing find command option

Hi,

I am a little bit confusing of using find command.

Actually, I am planning to delete the files whatever the files are existing in the day before yesterday. So, I am writing the command like this.

find . -name "*.txt" -ctime -2 { here I am confusing, if I will use +2 or +1 also I am getting same result)

can you clarify me which one is correct.
# 2  
Old 03-29-2011
-ctime - lists out files per create date. If you are looking for files created 2 days ago then try as -ctime +2 or files created less than 2 days then -ctime -2 or files created exactly 2 days ago then -ctime 2.
# 3  
Old 03-29-2011
what is the difference between 2 days ago and less than 2 days.

Could you clarify with examples?
# 4  
Old 03-29-2011
# 5  
Old 03-29-2011
Taking todays date (Mar 29) as a standard date. 2 days ago would mean days before Mar 27 i.e Mar 26, 25 etc. Less than 2 days would mean days after Mar 27.
# 6  
Old 03-29-2011
See my thread on ctime, mtime, and atime in our tutorials section. The second post in that thread explains the find options.
https://www.unix.com/tips-tutorials/2...ime-atime.html
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Prune Option for Find Command on AIX

I need to delete all files from the working directory and its sub directories using the find command, for that I am using -prune option but some how I am having a syntax issue. I have tried the below, please help me correct the syntax find . -name \* -type f -exec rm -f {} \; >> Works but... (4 Replies)
Discussion started by: rosebud123
4 Replies

2. Shell Programming and Scripting

Maxdepth option of find command not working

Can you please figure out what is the issue here $ find . -maxdepth 1 -type f -size 0 -print find: bad option -maxdepth please find the OS details $ uname -a HP-UX g5u1216 B.11.31 U ia64 2614088426 unlimited-user license Use code tags, thanks. (6 Replies)
Discussion started by: TomG
6 Replies

3. Shell Programming and Scripting

Variable inside -name option for find command

Hi, I am not able to get output for find command if there are variables defined inside -name option . Please check below example 1) ###VARIABLES DEFINED process="fast" temperature="125c" voltage="0p935v" 2) I don't get output for below find command find -L <PATH> -type f \( -name... (2 Replies)
Discussion started by: gujrathinr
2 Replies

4. UNIX for Dummies Questions & Answers

AIX find command using prune option

Hi, I am trying to find some files in a directory and then remove/list them if they are 30 days old. I also have 2 directories in that directory which I need to skip. Can someone please tell me what is the correct syntax? find /developer/. -name "lost+found" "projects" -prune -o -type f... (2 Replies)
Discussion started by: tkhan9
2 Replies

5. Shell Programming and Scripting

Please suggest me a better option than FIND command

Hi All, Could you please help me in searching files in a better way satisfying the below conditions I want to search files in a path whose access time is more than 5min and less than 60 min and whose Byte size is greater than zero For this, i am using the below command, but it is... (2 Replies)
Discussion started by: sparks
2 Replies

6. Shell Programming and Scripting

complicated exclude option in find command

Hi all, In a directory, I have many video files. Example : As you can see, some of the video files come with a .aspx file (wich means the video is actually being uploaded and not entirely written on the FS) I try to write a bash script that would find all video files in the ... (1 Reply)
Discussion started by: gniagnia
1 Replies

7. Shell Programming and Scripting

daystart option not working in find command

Hi, I am trying to list all the files created / modified today in a directory. With reference to this thread, https://www.unix.com/shell-programming-scripting/20324-capture-all-today-files.html I have used the below command to list all the files modified today. find . -daystart -type f... (8 Replies)
Discussion started by: arunkumarmc
8 Replies

8. Shell Programming and Scripting

help with find command and prune option

Hi I have a directory say mydir and inside it there are many files and subdirectories and also a directory called lost+found owned by root user I want to print all files directories and subdirectorres from my directory using find command except lost+found If i do find . \( -name... (3 Replies)
Discussion started by: xiamin
3 Replies

9. UNIX for Dummies Questions & Answers

help me out with find command , -prune option

Hi , Kindly help me out .:) i want to find only the file t4 in directory t3. i am in dir t . the tree is as follows. if i give, find . o/p is . ./t4 ./t1 ./t1/t2 ./t1/t2/t3 ./t1/t2/t3/t4 ./t1/t2/t4 ./t1/t4 directories are like t/t1/t2/t3 and each directory has file t4. my... (7 Replies)
Discussion started by: bhuvaneshlal
7 Replies

10. Shell Programming and Scripting

unix find command without mmin option

I need to check if a file has been modified within the last x hours. My find command does not have the mmin option -- only the mtime option which is in 24 hour perriods (1 Reply)
Discussion started by: Bill Ma
1 Replies
Login or Register to Ask a Question