Posts Tagged shell

Quickly search for a file on a (PC) server from a Mac client

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. 
# Hit ENTER
#
# 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

No Comments

Remove and ignore dreamweaver dwsync.xml files from your GIT repo

git ignore dreamweaver dwsync.xml files (and other gubbins as required)

  1. Remove any files already added form the working directory. For example:

    $ git rm -f *dwsync.xml

  2. set up your a global git ignore file

    create a gitignore file in your home directory. eg:

    $ printf "dwsync.xml\nThumbs.db\n" >> ~/.gitignore

    using git config add this to you git prefs

    $ git config --global core.excludesfile ~/.gitignore

For repos that may be worked on by multiple users you should also create this file at the root of your working directory.

References
hcodep://jqr.github.com/2009/02/03/global-git-ignore.html
hcodep://help.github.com/ignore-files/

,

1 Comment