cancel
Showing results for 
Search instead for 
Did you mean: 
DangDinhBang
Mission Specialist
Mission Specialist
  • 290 Views

find work on / but not work on /root

Jump to solution

i have 2 belows command for find

find /Custom_log_Backup -maxdepth 1 -mtime +1 -type f -name OMlog* ! -iname "*.gz" | tail
find /Custom_log_Backup -maxdepth 1 -mtime +1 -type f -name debuglog* ! -iname "*.gz" | tail

with first command. it run ok when i run it on /, but not OK when i run it on the /root.

0-0-1:/root-# find /Custom_log_Backup -maxdepth 1 -mtime +1 -type f -name OMlog* ! -iname "*.gz" | tail
0-0-1:/root-# cd /
0-0-1:/-# find /Custom_log_Backup -maxdepth 1 -mtime +1 -type f -name OMlog* ! -iname "*.gz" | tail
/Custom_log_Backup/OMlog0Dec28_2025
/Custom_log_Backup/OMlog1Dec28_2259
/Custom_log_Backup/OMlog1Jan3_2144
/Custom_log_Backup/OMlog2Dec29_0320
/Custom_log_Backup/OMlog6Jan6_2341
/Custom_log_Backup/OMlog2Jan4_0050
/Custom_log_Backup/OMlog6Jan5_0439
/Custom_log_Backup/OMlog0Jan5_2149
/Custom_log_Backup/OMlog1Jan6_0034
/Custom_log_Backup/OMlog2Jan6_0447
0-0-1:/-#

 

whith 2nd command. i can run it ok on both / and /root. does anyone know the reason.

0-0-1:/-# find /Custom_log_Backup -maxdepth 1 -mtime +1 -type f -name debuglog* ! -iname "*.gz" | tail
/Custom_log_Backup/debuglog1Jan8_0819
/Custom_log_Backup/debuglog2Jan8_0838
/Custom_log_Backup/debuglog3Jan8_0128
/Custom_log_Backup/debuglog4Jan8_0151
/Custom_log_Backup/debuglog5Jan8_0215
/Custom_log_Backup/debuglog6Jan8_0242
/Custom_log_Backup/debuglog7Jan8_0310
/Custom_log_Backup/debuglog8Jan8_0338
/Custom_log_Backup/debuglog0Jan8_0407
/Custom_log_Backup/debuglog1Jan8_0440
0-0-1:/-# cd /root
0-0-1:/root-# find /Custom_log_Backup -maxdepth 1 -mtime +1 -type f -name debuglog* ! -iname "*.gz" | tail
/Custom_log_Backup/debuglog1Jan8_0819
/Custom_log_Backup/debuglog2Jan8_0838
/Custom_log_Backup/debuglog3Jan8_0128
/Custom_log_Backup/debuglog4Jan8_0151
/Custom_log_Backup/debuglog5Jan8_0215
/Custom_log_Backup/debuglog6Jan8_0242
/Custom_log_Backup/debuglog7Jan8_0310
/Custom_log_Backup/debuglog8Jan8_0338
/Custom_log_Backup/debuglog0Jan8_0407
/Custom_log_Backup/debuglog1Jan8_0440
0-0-1:/root-#

 

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
Fran_Garcia
Starfighter Starfighter
Starfighter
  • 271 Views

Your command is wrong because you are not quoting the filename with the asterisk:eg:  "debuglog*" .  

You probably have some file named debuglogSOMETHING in /root, therefore the command is expanded to:

 

find /Custom_log_Backup -maxdepth 1 -mtime +1 -type f -name debuglogSOMETHING ! -iname "*.gz" | tail

 

Change your command to:

find /Custom_log_Backup -maxdepth 1 -mtime +1 -type f -name "debuglog*" ! -iname "*.gz" | tail

View solution in original post

2 Replies
Fran_Garcia
Starfighter Starfighter
Starfighter
  • 272 Views

Your command is wrong because you are not quoting the filename with the asterisk:eg:  "debuglog*" .  

You probably have some file named debuglogSOMETHING in /root, therefore the command is expanded to:

 

find /Custom_log_Backup -maxdepth 1 -mtime +1 -type f -name debuglogSOMETHING ! -iname "*.gz" | tail

 

Change your command to:

find /Custom_log_Backup -maxdepth 1 -mtime +1 -type f -name "debuglog*" ! -iname "*.gz" | tail

DangDinhBang
Mission Specialist
Mission Specialist
  • 268 Views

thank Fran,

 

for debug log, you can see it inside Custom_log_Backup also as below.

/Custom_log_Backup/debuglog1Jan8_0819
/Custom_log_Backup/debuglog2Jan8_0838
/Custom_log_Backup/debuglog3Jan8_0128
/Custom_log_Backup/debuglog4Jan8_0151

but adding 'OMlog*', and it is OK.

0 Kudos
Join the discussion
You must log in to join this conversation.