Please Explain me this command


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Please Explain me this command
# 1  
Old 02-04-2011
Please Explain me this command

Code:
find . -type f -ctime +3 -exec mv {} /somedirectory/  \;

in particular "-ctime v/s -mtime" and "difference between +3 and -3"

Last edited by Scott; 02-04-2011 at 04:33 PM.. Reason: Code tags
# 2  
Old 02-04-2011
ctime == last change to metadata - inode information, ownership, and protection mask
-3 == less than three days, 72 hours, since the last change. +3 is more than three days.
This User Gave Thanks to jim mcnamara For This Post:
# 3  
Old 02-04-2011
If the file data was changed, the file was modified (-mtime).
If the directory entry is changed, say from permissions then the file is changed (-ctime).
This User Gave Thanks to AlphaLexman For This Post:
# 4  
Old 02-04-2011
Actually Im trying to move files older than 3 days to some other directory.
Code:
find . -type f -mtime +3 -exec mv {} /somedirectory/  \;

is this correct? or I should use ctime?
mtime is correct right?

Last edited by Scott; 02-04-2011 at 04:33 PM.. Reason: Code tags
# 5  
Old 02-04-2011
That depends on your conditions of 3 days old.

If your wrote a script say yesterday, but forgot to 'chmod +x myscript.sh' until today, the file would be moved differently for -ctime vs. -mtime.

But if you are just talking about log files or something just data structured I would use -mtime instead of -ctime.
# 6  
Old 02-04-2011
Yes today Im running this command to move trace files. I want only 3 days old files should be in bdump, rest moving to other directory.
Then the above -mtime command works right?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Explain iconv command

I have a requirement to remove all non-ascii characters from a fixed length file. I used the below command which is removing special characters but somehow the total record length is being truncated to one space less. If it is a multi-byte string then many characters at the end are being truncated.... (8 Replies)
Discussion started by: eskay
8 Replies

2. Shell Programming and Scripting

Can someone explain the following shell command?

Hi Forum. I have the following script /home/user/EDW_ENV.sh to setup some environment variables as: ##### section 1 PM_HOME ##### export PC_DIR_BASE=/data/informatica/ming export DIR_ORACLE=/data/sw/apps/oracle/Oracle_scripts export... (4 Replies)
Discussion started by: pchang
4 Replies

3. Red Hat

Please help to explain the command

su - keibatch -c ""date ; /usr/local/kei/batch/apb/bin/JKEIKYK4140.sh -run "&$C$6&" WSUKE100201"" Not clear about : date ; /usr/local/kei/batch/apb/bin/JKEIKYK4140.sh -run "&$C$6&" WSUKE100201 Please help (2 Replies)
Discussion started by: honda_city
2 Replies

4. UNIX for Dummies Questions & Answers

Please explain this grep command

Please explain grep -A 999999. I've seen this before, it always seems to be with six 9's as well. See an example below. grep 'regexp' -A 999999 server.log | egrep -c 'Option=\' (6 Replies)
Discussion started by: scj2012
6 Replies

5. UNIX for Dummies Questions & Answers

Please explain this command?

Hi, I saw this. But I don't know why we need this? ls mydir > foo.txt ## I know what this will do, it will take the results and write to the file called foo.txt ls mydir > foo.txt 2>&1 ## Don't know why we need 2>&1 Thanks. (2 Replies)
Discussion started by: samnyc
2 Replies

6. Shell Programming and Scripting

can you explain this perl command?

I am using this line of perl code to change the file format and remove ^M at the end of each line in files: perl -i -pe's/\r$//;' <name of file here> Can you explain to me what this code does, and translate it into bash/awk/sed? (2 Replies)
Discussion started by: locoroco
2 Replies

7. UNIX for Dummies Questions & Answers

Can anyone explain what this command is doing?

Specifically what is the purpose of sed? What is f? Why is the 'cp f $phonefile' line needed when the script ‘goes live'? Why might that two commands following sed be commented out at the present time ( i.e., during development)? Thanks in... (2 Replies)
Discussion started by: knp808
2 Replies

8. Shell Programming and Scripting

please explain the command

Hi all , please explain the following command : perl -e 'select(undef,undef,undef,.15)' Thanks and Regards Navatha (2 Replies)
Discussion started by: Navatha
2 Replies

9. UNIX for Dummies Questions & Answers

Explain the output of the command....

Explain the output of the command “sort -rfn file1 | more” (1 Reply)
Discussion started by: wickbc
1 Replies

10. UNIX for Dummies Questions & Answers

Please explain this command line ?

Please explain this command line ? wc<infile<newfile Thanx, Saneesh Joseph. (2 Replies)
Discussion started by: saneeshjose
2 Replies
Login or Register to Ask a Question