Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unix command error

when I try this command I'm getting the right path

find /home/*/*/*/*.log

result is

 /home/blross23/karthi/mmw/sample.log

But When I try this command

find /home/*/*/*/*.log -mtime +1  -type f -size +2  -printf "%s %h%f\n"

The result I'm getting is

7950 /home/blross23/karthi/mmwsample.log

where at the end of the path "/" (mmwsample.log )is missing between the two directories

correct path is /..../mmw/sample.log What I'm getting is /..../mmwsample.log

What's the error in the command ???

like image 759
Karthikeyan Sivamani Avatar asked Feb 15 '26 09:02

Karthikeyan Sivamani


1 Answers

Conseider the format in your command:

find /home/*/*/*/*.log -mtime +1 -type f -size +2 -printf "%s %h%f\n"

You are specifically telling it to print those two values without a '/' between them. To correct it, try:

find /home/*/*/*/*.log -mtime +1 -type f -size +2 -printf "%s %h/%f\n"

like image 100
David Hoelzer Avatar answered Feb 18 '26 09:02

David Hoelzer



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!