Using Visual Studio's 'Find', is it possible to exclude specific files from the search? - visual-studio-2013

Let's say i refactored some code in my huge solution, now i want to be sure that there are no occurencies of my old code (including specific words in strings and so one).
Problem is, that i have a huge, automatically built file (imagine something like a 'compiled' app.js), which is allowed to contain string values of my old code.
With the 'Find' functionallity of Visual Studio, is it possible to skip this specific file?

One possible way I could think off is Look at these file types field present in Find and Replace (Shortcut: Ctrl + Shift + F).
You could specify the file types with extensions or/and names. You could use multiple names separated by a semicolon.
Ex: Say you want to search in all XAML files & all CS files starting with A. You would enter this in the Look at these file types field: *.xaml;A*.cs

If you simply want to ensure that your only matches are in that one file, you can check "Display file names only" option in "Find in Files", and verify that there is only that file name in the result pane.

Related

How to replace/remove tag in multiple csproj files

Is it possible to remove tag from multiple csproj files (e.g. NuGetPackageImportStamp) by using search and replace functionality?
Actually Notepad++ has 'Find in files' functionality to replace in files in the selected location. It is possible to insert filter, use regex...
Sorry for bothering. I didn’t even think to look there.

Is it possible to append prefix to files names taken from folder name, automatically? (Windows)

I work as technical photographer. I do a lot of photos of particular parts. Each parts get a folder assigned and then I copy photos to the folder.
I would like the names of files (photos) get a prefix which is folder name. Example:
I take 20 photos of part A1. I copy those 20 photos from SD card to my PC to previously created folder named "A1". I would like those 20 files to have names as follows:
A1(1)
A1(2)
A1(3)
[...]
A1(20)
Is it possible to make it automatic? or do it by one click?
Thanks in advance
If you don't need to preserve the original numbering, it's as simple as selecting all the files in Explorer, pressing F2 (for rename) and typing in the new name. The files will automatically get non-colliding names in the form of "Name (number)".
This respects the ordering you have selected in Explorer, so if you want the index to increment from older to newer files, for example, just sort the files by date ascending.
This can also be used to preserve the original numbering, but only if there are no gaps and if the numbers start from 1. If you sort the files by name and do the rename trick, they will still be ordered the same as before. If there are gaps, they will not be there anymore with the new file names, though.
One more gotcha is that this only works if all of the files have the same extension. If some are jpg and others png, for example, each extension will get its own numbering.
If this isn't good enough, you'll either have to use a script, which is a bit more advanced, or some tool that helps with batch renaming. My favourite has been Total Commander for a long time - in TC, this is as simple as selecting the files you want to rename, pressing Ctrl+M, and changing the file name to something like A1 ([N]).

Rules for file extensions?

Are there any rules for file extensions? For example, I wrote some code which reads and writes a byte pattern that is only understood by that specific programm. I'm assuming my anti virus programm won't be too happy if I give it the name "pleasetrustme.exe"... Is it gerally allowed to use those extensions? And what about the lesser known ones, like ".arw"?
You can use any file extension you want (or none at all). Using standard extensions that reflect the actual type of the file just makes things more convenient. On Windows, file extensions control stuff like how the files are displayed in Windows Explorer and what happens when you double click on it.
I wrote some code which reads and writes a byte pattern that is only
understood by that specific programm.
A file extension is only an indication of what type of data will be inside, never a guarantee that certain data formatted in a specific way will be inside the file.
For your own specific data structure it is of course always best to choose an extension that is not already in use for other file formats (or use a general extension like .dat or .bin maybe). This also has the advantage of being able to use an own icon without it being overwritten by other software using the same extension - or the other way around.
But maybe even more important when creating a custom (binary?) file format, is to provide a magic number as the first bytes of that file, maybe followed by a file header structure containing a version number etc. That way your own software can first check the header data to make sure it's the right type and version (for example: anyone could rename any file type to your extension, so your program needs to have a way to do some checks inside the file before reading the remaining data).

How to find file that is missing a required string in eclipse/windows?

Is there a tool that can help me flag or list all the files (usually code files like java, xml, sql, etc) in a directory, which do not contain a particular string within the code.
For Ex: I need a list of all the files in my project that do not contain the word "author" (the text could be arbitrary).
I have seen a similar question here, but it is for the OS-X and not for Windows/eclipse platform.
A simple way would be to make a copy of the tree, find all the files which contain the word, and delete them. The remaining files are the ones which don't contain the word.

Include only certain file types when searching in Visual Studio

Often when I want to search through my code in Visual Studio, I know the thing I'm looking for is in some C# code. However, as I've used the same variable name in a JavaScript file, I have to wade through all those search results too. This gets even worse when the text I'm looking for is also used in a third-party JavaScript library that we've brought into the project: this can result in hundreds of search results.
To compound things, our designers include HTML mock-ups of the pages in the same project, so I often find I'm hitting loads of search results in there too.
I guess what I really want is to see results in my .cs, .aspx, and .ascx files, but not .js or .htm.
Is there any way to do any of the following:
Search only in files of a particular type (search only .cs files).
Search only in files of any of a given set of types (search only .cs, .aspx and .ascx files).
Search in all file types except a particular type or types (search everything except .js).
I suspect not, in which case is there any crafty way of working around this?
In the Find in Files dialog (Ctrl+Shift+F), there should be a field called Find Options. You should be able to enter the extensions of fields you want to search in a field in this dialog:
*.cs; *.aspx; *.ascx;
Instead of Ctrl + F, I think it is Ctrl + Shift + F which gives you the choice to specify file types, you wish to look into.
You can choose file types from default or type your own. Regular expressions available for complex search.
Another way to limit file searches is by only choosing certain folder sets.
I like to exclude js files by using the following search:
*.a*;*.cs*;
Most of the times, I end up searching for stuff in aspx, cs, cshtml files so this is quite helpful.
Notice how I use *.cs* instead of *.c* since the latter would select jquery custom files such as jquery.custom1234.js (which I usually use in most of my projects), of course if you don't you could just use *.c*.
In the Find dialog box, go to "find options->Look at these file types".
Type in you own string, eg, *.cs, *.aspx, *.ascx. The click the "find all" button.

Resources