Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am trying to make my Windows System as compatible with existing Makefiles as possible. One great step that is missing is replacing the windows "find" (which is the same as grep) with the GNU find (list of all files in directory and sub directories). Is this possible? (I already have msys find installed and ready to go. Just removing system32/find.exe would probably work, but unfortunately it is not possible that easily)

share|improve this question
    
I rename my gnu utils find.exe to ufind.exe and use ufind –  user619818 Aug 10 at 12:03
    
The problem with that is, that this solution would result in different Makefiles across building platforms (as long as I didn't wish to create a ufind link on my Linux machines) –  th3falc0n Aug 10 at 12:06
10  
Don’t do this. It will break stuff. Instead, use a GNU environment like Cygwin or MinGW. –  Daniel B Aug 10 at 12:42
    
Well if I use the shell provided with msys in MinGW (which I am using) it is still dependent on Windows PATH variable which defines system32 and SysWOW64 as search paths and thus overrides the msys find. –  th3falc0n Aug 10 at 12:47
1  
If you use bash.exe or sh.exe then using find will invoke the GNU find instead of the Win32 find. sh.exe and bash.exe come with git or MinGW. –  Rapptz Aug 10 at 17:18

2 Answers 2

up vote 14 down vote accepted

Rather than removing Windows' find.exe, I strongly recommend putting GNU in your path before Windows\System32. For example, with Cygwin, you can use something like:

path c:\cygwin\bin;c:\windows\system32;c:\windows;c:\program files\foo;c:\program files\bar;c:\windows\system32\wbem

share|improve this answer
    
No need to do this manually, of course—it’s simply how this stuff works. From MSYS’ /etc/profile: export PATH=".:/usr/local/bin:/bin:/mingw/bin:$PATH" –  Daniel B Aug 10 at 13:19
1  
If you go this route, it's better to limit the scope as much as possible. Don't change PATH for the entire system; change it only for the application you use (e.g. have a special batch file to launch a prompt with set PATH=\path\to\cygwin;%PATH%). This limits potential surprises later when you or someone else expects a Windows utility and instead gets a *nix one. –  Bob Aug 10 at 14:56

You can gain access to all protected files by changing the ownership.

For Windows 7, on the file or folder that you want to edit:

  • Go to Properties->Security->Advanced->Owner
  • Change owner to either Administrators or your own User
  • On Properties->Security grant rights to the new owner

Source: Windows 7 – How to Delete Files Protected by TrustedInstaller

share|improve this answer
2  
Please include necessary steps in your answer. If the link dies at some time your answer will become much less useful. –  gronostaj Aug 10 at 12:27
    
And then any Windows Update (be it a bug fix, security fix, Service Pack or otherwise) could replace find.exe with the "correct" version again. This is a "global" solution to a "local" problem and they're invariably always a bad idea.. –  Rob Aug 10 at 15:09
2  
You guess why I marked salehigal's answer as correct?, Mine is the solution to the problem I asked for, salehigal's solution is for the problem I actually had. –  th3falc0n Aug 10 at 15:29

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.