Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

linux find command is not working properly

Tags:

linux

I am using Linux(Ubuntu), I am trying to find the files, but it is not working properly. I have created some files in my directory structure, for example: World/India/Maharashtra/Pune/filename.xml

When I use the find command like:

find /home/lokesh/Desktop/Testing_India2/Test/World/India/Maharashtra/ -name filename*.xml -mmin -3000

It is giving the result perfectly.

But, when I am using the same command at "World" or "India" level:

find /home/lokesh/Desktop/Testing_India2/Test/World/ -name filename*.xml -mmin -3000

it does not give any result.

I have lots of directories at "India" level as well as at "Maharashtra" level and may be some directories within "Maharashtra's" inner directories. I have to find each file created in all directories. And I have mounted all folders from different machine.(I mean some state from different and some from different machine.)

If someone knows how to solve this problem please reply me as soon as possible.

like image 680
Lokesh Paunikar Avatar asked Dec 27 '10 10:12

Lokesh Paunikar


2 Answers

Double quote your search string and -L to make it follow symbolic links:

find -L /home/lokesh/Desktop/Testing_India2/Test/World/ -name "filename*.xml" -mmin -30000
like image 147
ismail Avatar answered Oct 12 '22 16:10

ismail


This is something I ran into earlier today actually when using the '*' wildcard. I couldn't get it to continually traverse the subdirectories unless I escaped the * with a .

Give this a try:

find -L /home/lokesh/Desktop/Testing_India2/Test/World/ -name filename\*.xml -mmin -30000
like image 34
TDarwin Avatar answered Oct 12 '22 16:10

TDarwin