البحث عن كلمة او نص او محتوى معين في المجلدات والملفات

البحث عن كلمة او نص او محتوى معين في المجلدات والملفات

السلام عليكم ورحمة الله وبركاته 

البحث عن كلمة او محتوى ما في المجلدات والملفات

منذ مدة كنت اعاني من موضوع البحث عن اسماء او كلمات معينة ضمن آلاف الملفات الموجودة في جهاز الحاسوب وبحثت عبر الانترنت عن شيء يُحدث فرق معي في البحث بحيث لا يأخذ مني وقت وجهد لأجد ما ارغب بكل سهولة ويسر دون العناء في البحث مطولا في اروقة ومجلدات الحاسوب.  

الجهاز المستخدم في التجربة 

فاحببت مشاركتها معكم ولتكون في المفضلة لدي ضمن المقالات في الموقع مصدرنا اليوم من هذا الموقع . واتمنى ان يستفيد منه احد وتتم مشاركته٬بالنسبة في الوقت الراهن تم استخدام الاوامر في  جهاز “ماك برو” ففي المثال التالي تم تطبيقه على جهاز MackBook Pro نسخة الـ 13″ إنش من نظام التشغيل macOS Mojave 10.14.6  

الأوامر المستخدمة في عملية البحث عبر تطبيق Terminal

فمن الممكن ان لا تعمل للنسخ الاقدم او الاحدث ولكن على حد علمي انها ستعمل لانها تعتمد على الاوامر (commands) من النظام ذاته. ولكن حسب تجربتي فالأمر (command)  عمل معي في النسخة التي تم ذكرها.

الأمر التالي سينفعك للبحث عن كلمات معينة او اسماء او ارقام من داخل محتوى الملفات فعلى سبيل المثال اذا كنت ابحث عن كلمة او جملة ما ستظهر نتائج البحث عن مسار الملفات الموجودة داخل المجلدات الموجودة على جهاز الحاسوب المستخدم.

الأمر التالي يُمكنك من البحث في الجهاز بشكل عام فلم تخصص في عن المجلد الذي ترغب في البحث فيه محتواه او المجلدات الفرعية التي يضمها. حتى انه يظهر لك رسائل البريد الإلكتروني التي وصلت عبر برنامج “مايكروسوف اوت لوك “.
ولإظهار نتائج البحث يجب ان يكون البريد الإلكتروني المفعل فعليا هو البريد الإلكتروني الإفتراضي للتمكن من فتح البريد الإلكتروني.

افتح تطبيق او برنامج Terminal واكتب ادناه بعد كلمة mdfind تضع مسافة وبعدها الكلمة المراد البحث عنها.

mdfind الكلمة او النص المراد البحث عنه 

في حال رغبت في البحث عن كلمة معينة في مجلد محدد بإمكانك تحديد موقع المجلد للبحث من خلال المجلد كله مع المجلدات الفرعة. فالأمر التالي قد يساعدك. فلنفترض ان المجلد المراد البحث فيه عن الكلمة او النص موجود في المجلد Desktop الذي يحتوي المجلد الذي يراد من خلاله البحث عن المعلومات المطلوبة. بإمكانك البحث مع علامة الاقتباس أو بدونها سيعمل الامر سواء كانت الكلمة او النص باللغة العربية او الانجليزية. 

mdfind Desktop/documents “فاتورة” 

في حال كانت كلمات البحث غير متوفرة لن يتم عرض اي شي كأنك بدأت في سطر جديد لإعطاء امر آخر. 

أجهزة نظام التشغيل “وندوز” Windows

ومن الجهة الأخرى لأصحاب أجهزة نظام التشغيل “وندوز” Windows، فإمكانهم عبر النظام تفعيله بالطريقة التالية بالفيديو بحيث تبحث عن البيانات بكل سهولة سيتم فيما بعد تجربته وعرض التجربة في حال فشلت او نجحت او سيتم البحث ايضا عن طريق تطبيقها للأوامر CMD


وبالاسفل بإمكانك معرفة وقراءة المزيد عن الامر أعلاه وتم نسخ البيانات من المصدر الذي ذكره مسبقا لنظام macOS

mdfind
Spotlight search.
Syntax
mdfind [-live] [-count] [-onlyin directory] queryKey
query A string or query expression.
-0 Print an ASCII NUL character after each result path.
This is useful when used in conjunction with xargs -0.
-live Causes the mdfind command to provide live-updates to the
number of files matching the query. When an update causes the
query results to change the number of matches is updated.
The find can be cancelled by typing ctrl-C.
-count Output the total number of matches, instead of the path
to the matching items.
-onlyin dir Limit the scope of the search to the directory specified.
-literal Force the provided query string to be taken as a literal
query string, without interpretation.
-interpret Force the provided query string to be interpreted as if the
user had typed the string into the Spotlight menu.
For example, the string “search” would produce the following
query string:
(* = search* cdw || kMDItemTextContent = search* cdw)
Spotlight Keywords.
These can be included in the query expression to limit the type of documents returned:
Applications kind:application, kind:applications, kind:appAudio/Music kind:audio, kind:musicBookmarks kind:bookmark, kind:bookmarksContacts kind:contact, kind:contactsEmail kind:email, kind:emails, kind:mail message, kind:mail messagesFolders kind:folder, kind:foldersFonts kind:font, kind:fontsiCal Events kind:event, kind:eventsiCal To Dos kind:todo, kind:todos, kind:to do, kind:to dosImages kind:image, kind:imagesMovies kind:movie, kind:moviesPDF kind:pdf, kind:pdfsPreferences kind:system preferences, kind:preferencesPresentations kind:presentations, kind:presentationDate Keywords.
These can be included in the query expression to limit the age of documents returned:
date:today    $time.today()
date:yesterday .yesterday()
date:this week  .this_week()
date:this month .this_month()
date:this year  .this_year()
date:tomorrow  .tomorrow()
date:next month  .next_month()
date:next week  .next_week()
date:next year  .next_year()
Comparison Operators
By default mdfind will AND together elements of the query string.
(OR) To return items that match either word, use the pipe character: stringA|stringB
 (NOT) To exclude documents that match a string -string“equal”
== “equal”
!= “not equal”
< and > “less” or “more than”
<= and >= “less than or equal” or “more than or equal”
InRange(attributeName,minValue,maxValue) Numeric values within the range of minValue to maxValue in the specified attribute.
Whitespace is significant when building a query, use parentheses () to create groups.
Characters such as “ and ‘ in the value string should be escaped using the character
Value Comparison modifiers
kMDItemAuthors ==[c] “Steve”
To get a list of the available attributes for use in constructing queries, see mdimport(1), particularly the -X switch. Not all files are indexed by spotlight and not all file attributes are present on all files, image files, iCal files and music files all support different attributes.
Examples
Returns all files with any metadata attribute value matching the string “image”:
$ mdfind image
Return all files that contain “Len Deighton” in the kMDItemAuthor metadata attribute:
$ mdfind “kMDItemAuthor = ‘*Len Deighton*'”
Return all files with any metadata attribute value matching the string “skateboard”. The find continues to run after gathering the initial results, providing a count of the number of files that match the query.
$ mdfind -live skateboard
Return all Microsoft.Word document files:
$ mdfind “kMDItemContentType = ‘com.microsoft.word.doc'”
Return files where the composer name includes ‘Eno’ (non case sensitive search):
$ mdfind ‘kMDItemComposer = “*ENO*”c’
Return all image files matching the words ‘maude’ and ‘paris’:
$ mdfind “kind:images maude paris”
Return all the files that have been tagged as ‘Green’:
$ mdfind “kMDItemUserTags = Green”
Return all the documents created with any version of Pixelmator:
$ mdfind “kMDItemCreator = Pixelmator*”
Return all image files last edited yesterday:
$ mdfind “kind:image date:yesterday”
Return all files in the users home folder (~) that have been modified in the last 3 days:
$ mdfind -onlyin ~ ‘kMDItemFSContentChangeDate >= $time.today(-3)’

Modifier Description
c The comparison is case insensitive.
d The comparison is insensitive to diacritical marks.

kMDItemAuthors ==[c] “Steve”
To get a list of the available attributes for use in constructing queries, see mdimport(1), particularly the -X switch. Not all files are indexed by spotlight and not all file attributes are present on all files, image files, iCal files and music files all support different attributes.
Examples
Returns all files with any metadata attribute value matching the string “image”:
$ mdfind image
Return all files that contain “Len Deighton” in the kMDItemAuthor metadata attribute:
$ mdfind “kMDItemAuthor = ‘*Len Deighton*'”
Return all files with any metadata attribute value matching the string “skateboard”. The find continues to run after gathering the initial results, providing a count of the number of files that match the query.
$ mdfind -live skateboard
Return all Microsoft.Word document files:
$ mdfind “kMDItemContentType = ‘com.microsoft.word.doc'”
Return files where the composer name includes ‘Eno’ (non case sensitive search):
$ mdfind ‘kMDItemComposer = “*ENO*”c’
Return all image files matching the words ‘maude’ and ‘paris’:
$ mdfind “kind:images maude paris”
Return all the files that have been tagged as ‘Green’:
$ mdfind “kMDItemUserTags = Green”
Return all the documents created with any version of Pixelmator:
$ mdfind “kMDItemCreator = Pixelmator*”
Return all image files last edited yesterday:
$ mdfind “kind:image date:yesterday”
Return all files in the users home folder (~) that have been modified in the last 3 days:
$ mdfind -onlyin ~ ‘kMDItemFSContentChangeDate >= $time.today(-3)’
“The real voyage of discovery consists not in seeking new landscapes but in having new eyes” ~ Marcel Proust