WinSCP: Find option lists all folders - winscp

I am using WinSCP for navigating all my unix (virtual) machines.
When I use the "find"-dialog to search for specific file names and try to use a simple mask "status.dat". Why does it list all my directories?
It's miraculous...
Do you have ideas?

It can depend on the exact version of the WinSCP you are using:
Bug 840 has been fixed in 5.0.7, and was about:
When finding files, all directories are implicitly found

Related

In TortoiseSVN on Windows, is there any utility that allows a user to search for text within the repo?

In TortoiseSVN on Windows, is there any utility that allows a user to search for a text string through the repo? We store a bunch of reporting SQL in SVN and would like to expedite the task of impact analysis on reports when corresponding names change etc. Not sure if all the code is within one repo or not?
If you have Cygwin installed, you can use grep to search all files in a directory.
Open up a Cygwin terminal, and change into your svn directory.
cd /cygdrive/c/pathtoSVNrepo
Then use the following command to search all files in the directory.
grep -REHni searchString .
Replace 'searchString' with your text that you would like to search for. Note that this can also be a regular expression.
The command will produce output in the format: fileName:lineNumber: lineWithMatchingText
Example output:
If you're only interseted in which files contain the string, just an 'l' to the options.
grep -REHnil searchString .
You can use OpenGrok. You will have to connect it to your svn server, but it works great in our company.

How to search only in currently open files in vscode?

I usually work on larger projects with many files that would contain the search query. So I would open the files I want to modify and do a find/replace across all currently opened files. Can this be done in vs code?
The feature I'm looking for is implemented in Notepad++, but I'd prefer not to have to switch editors for this task.
For me somehow it works just by typing ./ in the files to exclude field.
The ability to search only in the open editors is in the Stable Build v1.55.
As you can see, the icon is at the end of the files to include input so you will have to have that showing (click the three dots ... just below the search options if files to include is not already showing).
"Search: target particular set of files #20530" located here: https://github.com/Microsoft/vscode/issues/20530
Is tracking a search "scope" such as "all open files".
Hit Ctrl + Shift + F and enable the icon at the end of the 'file to include' text field
I don't think there's a way to do this. You can make a feature request on github. I think an extension could do it though.
There is a checkbox for this in the "files to include" field since version 1.55 (march 2021).
The answer was already mentioned (and accepted above) indeed typing ./ in the files to exclude box of the search window will allow you to only search in open files.
However the response mentioned that he was unsure why this worked. VSCode allows you to exclude all files in a directory by writing the directory in the exclude box. The directory . is the directory where VSCode is opened ie the root directory. The filter ./ excludes all files in the VSCodes root directory so all files are excluded. However opened files ignore any exclude filter. So if you exclude all files only the opened files will be searched.
The best way to find something you are searching for within a specific file in vs code would be:
Ctrl + p then pressing # on the search bar.
It will give you a list of all functions on the file, which makes it easier to track something down.
As an alternative to using Visual Studio Code itself, you can just search the file contents within the folder where unsaved files open in Visual Studio Code are located. This would be in one of these locations depending on which OS you are running:
Linux: /tmp/ (someone else running Linux can verify this)
macOS: ~/Library/Application\ Support/Code/Backups/
Windows: %APPDATA%\Code\User\
This extension is what I use for this purpose.
You may need to change the keybinding if there is a conflict.

How can I find files that aren't needed on my site so I can delete them?

I'm developing a website, and after testing different ways to do things, I know that I have many files on my site that are not being used, including HTML/PHP files, images, stylesheets, and external scripts. Is there some program I can use or something so I can find all of the files that I don't need so I can delete them?
I need to find all files that are safe to delete, don't have anything to do with the site anymore, and that deleting them won't have any effect on how my site works.
I've tried finding orphaned files in Dreamweaver, but it lists a lot of files that I do actually need.
Here's one idea: Crawl the site and create a list of every file you can find, then check anything that's not on that list. Wikipedia has a list of crawlers including some open source ones.
Xenu's linksleuth is the easiest way I've found.
http://home.snafu.de/tilman/xenulink.html
After you do the scan you have the option to put in your FTP info. If you do so, it will also generate a list of files that are not accessible (orphans).
How would you qualify unnecessary? That's something you need to be sure of before beginning this. I guess one way to garbage collect your site is to delete files not being referenced by any other files.
The idea with the crawler #Brendan to get all files that actually are used is very nice.
Then you can start deleting files from your website and after that use a program to find any broken links in your website like Xenu or LinkTiger or then one you prefer.
You can connect with some ftp application, and delete files manual. This is the safest way, because scripts and programs don't know what is needed and what not...
This did not exist at the time this question was asked, but there is a Python script called weborphans designed for this purpose.
Here's a blog entry by the author with some more info: Finding orphaned files on websites

Search a Batch of Files for a Line of Text

I have a Mercurial Repository for a code project and I want to search all of the files, in all directories and sub-directories, for a given string. What is the best method, or program to do so?
I can conduct this search in Ubuntu Linux or a Windows environment.
Probably best to just do a checkout of the repository and use grepWin on windows, or grep on Linux.
For a simple search in the working copy, I would also use the normal grep program (I'm on Linux).
But if you want to search the history for a string, then note that Mercurial also has a hg grep function. That can be handy if you want to see when a given function, say, was introduced or removed.
If TortoiseHg is installed Search History is available in Windows Explorer context menu.

Comparing folder structure in two environments

Are there any good tools for comparing two folder structures (files included) between two environments?
i.e. comparing a dev computer with production
Edit:
A note on some lessons learned: dir /s /o:N >> output.txt works well in conjunction with a text comparison tool (I used WinMerge), but the filesystem does appear to matter. NTFS against FAT32 doesn't work well, as one scans the folders in reverse alphabetical order, and the other doesn't. To solve this issue, I copied the files from the FAT32 to an NTFS drive.
Also, DiffMerge is nice, but slow. It actually hung when run on the server (that's where I had access to both sets of files) to a point that I had to force a quit.
I'm sure others have thoughts on doing this with *NIX. Probably a similar technique like ls -alR > output
It's still pretty manual, but it works well.
Just keep in mind that the times on the folders will more than likely be different, so you may want to use a regex to replace them and make them more consistent, since that's fairly benign (I used [\d]{2}/[\d]{2}/[\d]{4}[\s]*[\d]{2}\:[\d]{2}\sAM[\s]*\<DIR\> and [\d]{2}/[\d]{2}/[\d]{4}[\s]*[\d]{2}\:[\d]{2}\sPM[\s]*\<DIR\>).
I use Diff merge (http://www.sourcegear.com/diffmerge/ - it has a free version) for comparing folder structures on Windows
For a tool that runs on Windows (but can work against Linux samba shares), try BeyondCompare.
One windows.
Use your favorite diff tool on the files generated from this cmd.
Run this from the folders you wish to compare.
c:\somefolder>dir /s > searchResult.txt
WinMerge also does folder and file comparison and its FREEE
Option 1)
Mount one of the machines on the other, then use some standard directory compare utility.
Option 2)
Use rsync --dry-run and use the output in some way.
Option 3)
Generate hashes (e.g. sha256) of the files on each side, then compare the lists.
WinDiff and KDiff both seem good at doing this without the need for command line dir listing. My personal preference is KDiff.
WinDiff shows an expanded list of all files/folders. (I was only interested in differences so turned off "Show Identical Files" in the Options menu).
KDiff presents an expandable tree view with nice colour coding.

Resources