Sponsored Content
Top Forums Shell Programming and Scripting What is wrong with 'find . -maxdepth 1 -ctime -7 -type f'? Post 302993707 by invinzin21 on Monday 13th of March 2017 02:42:58 PM
Old 03-13-2017
THIS IS CORRECT,
Code:
-rw-r-----.  1 root domain users         81 Mar  7 15:51 aa
drwxrwxr-x. 13 root domain users       4096 Mar  8 14:25 development
drwxr-x---.  2 root domain users       4096 Mar 13 16:19 630
[root@server1:~]$  find .  -maxdepth 1 -type f  -ctime -7
./.bash_history
./aa
./.viminfo
[root@server1:~]$


Same release and find version
Code:
[root@server2 ~]# ls -lrt | tail -4
drwxr-x---. 2 root    root         4096 Mar  7 15:53 bin/
-rw-r-----. 1 root    root            0 Mar 13 17:52 asdas
-rw-r-----. 1 root    root            0 Mar 13 17:54 aa
-rw-r-----. 1 root    root            0 Mar 13 18:04 asdf
[root@server2 ~]#


root@server2 ~]#  find .  -maxdepth 1 -type f  -ctime -7
./.tcshrc
./get_index_data.pl.20150602
./install_trace.34856
./.bashrc.20161130
./.viminfo
./bondNIC.sh
./install.log.syslog
./tao-cosconcurrency.20160720
./ks-post.log.1
./asdf
./get_index_data.pl_ORIG
./getAttachmentNames
./twave05.key




# ll install.log
-rw-r--r--. 1 root root 28080 Feb 17  2015 install.log
[root@server2 ~]#

---------- Post updated at 02:42 AM ---------- Previous update was at 02:33 AM ----------

what funny is...my command works on my other rhel servers. the same command..atime is totally different as well as mtime..believe me..i ran all the tests.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

ctime & find

I am trying to figure out the syntax to use find to remove files older than 30 minutes. I know that this will work for files 1 day old, but cannot seem to trim the time down to 30 minutes. find /path/to/file -ctime +1 -exec rm -f {} \; (1 Reply)
Discussion started by: 98_1LE
1 Replies

2. Shell Programming and Scripting

how to find ot ctime , mtime ,atime

Can any one tell me how to find out ctime , mtime ,atime for a file/directory on unix. Cheers, Nilesh (5 Replies)
Discussion started by: nilesrex
5 Replies

3. UNIX for Dummies Questions & Answers

Solaris find without maxdepth

Hi, I am using Solaris 5.8 I searched online, the find command has an option called maxdepth which can be used to limit the number of directories find will look into. find . -maxdepth 2 -type f When I run the above command in solaris, I get an error find: bad option -maxdepth find:... (2 Replies)
Discussion started by: Leion
2 Replies

4. UNIX for Dummies Questions & Answers

"-maxdepth 1" argument for Solaris find. Other way to restrict find in only one directory?

Hi I wish to find only files in dir /srv/container/content/imz06/. It means exclude subfolder /srv/container/content/imz06/archive/ > uname -a SunOS testbox6 5.10 Generic_139555-08 sun4v sparc SUNW,Sun-Blade-T6320Its Solaris default "find" > find /srv/container/content/imz06/* -name... (4 Replies)
Discussion started by: slashdotweenie
4 Replies

5. Shell Programming and Scripting

find -ctime

I know that find -ctime +1 will find ALL files that have been modified that are greater than 1 day old and -ctime 1 will find files that are ONLY 1 day old -ctime -1 mean files that are less than a day old? Can find actually use this granularity? (5 Replies)
Discussion started by: BeefStu
5 Replies

6. Shell Programming and Scripting

find -ctime

startdate="2012_07_04-16:14:4" path1="/home/drdos/sample" days=0 find $path1 -name "*$startdate*" > teste.txt while do find $path1 -name "*.zip" ctime $days > teste.txt days=`expr $days + 1` done echo " Files that are near the string u search are on teste.txt"Hi to... (2 Replies)
Discussion started by: drd0spt
2 Replies

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

8. Answers to Frequently Asked Questions

find "/path" -type f -ctime +30

When I use the command find "/abc/xyz" -type f -ctime +30 getting the error as find:"/abc/xyz /lost+found: Permission Denied" I tired find "/abc/xyz" -type d \( ! lost+found \) -type f -ctime +30 The error is find: paths must precede expression Usage: find Tried find "/abc/xyz"... (1 Reply)
Discussion started by: anithab
1 Replies

9. Shell Programming and Scripting

find -ctime -1 cannot find files without extention

The problem is this one. I tar and gzip files on remote server Code: find . -ctime -1 | tar -cvf transfer_dmz_start_daily.tar *${Today}*.*; Command Code: find . -ctime -1 Doesn't find files without extension Code: .csv .txt I have to collect all files for current... (1 Reply)
Discussion started by: digioleg54
1 Replies

10. Shell Programming and Scripting

find -ctime -1 cannot find files without extention

The problem is this one. I tar and gzip files on remote server find . -ctime -1 | tar -cvf transfer_dmz_start_daily.tar *${Today}*.*; Command find . -ctime -1 Doesn't find files without extension .csv .txt I have to collect all files for current day, when the program... (1 Reply)
Discussion started by: digioleg54
1 Replies
All times are GMT -4. The time now is 11:07 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy