Searching for files on a Windows server from a Mac can be very slow or even fail altogether but with a bit of shell trickery it’s very quick.

The script below is 95% instructions – the payload is at the end – that’s the line of code you’ll need to adapt for your search.

# Here's a simple shell script to search the server for a file(s) who's name you know
# 1. Specify the folder you want to search
# 2. Change the script to look for the file name
# 3. Job done
# 1 2 3
# Open Terminal and type "cd " (with the space) at the promp. 
# From the Finder drag the folder you want to search onto 
# the Terminal window, ENTER
# (You are now "in" the folder you want to search)
# Change the script below to use your search for your file
# (keep the wildcard *s and the quote marks)
# NB you can add the wildcard into a search too
# eg: "*Need*stack*" will find "A needle in a haystack.psd"
# Copy and paste into the Terminal window, ENTER
# (The search is case insensitive)
find . -iname "*Needle_in_a_haystack*" -print

Last updated on 5th September 2018