Compare directory using winmerge? - diff

I have two different directories and i am making a script which identify that if different directories have the same file name with different changes.i am trying with winmerge commaline option as below ..
WinMergeU C:\Folder\File.txt C:\Folder2
and i also want to merge the all changes into the one file.
Please suggest me on this.
thanks

When I compare folders with WinMerge, I go to File->Open, select folders and check the 'Include subfolders' check-box. Then in the View menu I switch on the Tree View and switch off Show Identical Items.

Here is the manual from Winmerge explaining on comparing two different folders -
http://winmerge.org/docs/manual/CompareDirs.html

The answer from Stanislav works well from the user interface.
From the command line (documentation), you need the flag /r to do the comparison recursively:
WinMergeU /r Folder1 Folder2
Then, as mentioned in Stanislav's post, you can go to the View Menu and Check the "Tree Mode" and uncheck "Show Identical Items" to get a clearer view of the differences.

Related

Remove properties from files in powershell

I need to remove all properties (title, author, camera,...) from files in one folder with PowerShell (in Windows 10). Is that even possible or any simple command to do that or would I need to remove each property one by one?
If you need a simple one-off solution or occasional solution Windows explorer has this function built-in.
Select all your files in the folder.
Right click one and select Properties then Details tab.
Bottom of Properties has "Remove Properties and Personal Information"
--Has options to create copies of files with properties removed
or remove from active files. Select properties individually or Select All.

How to rename multiple files in vscode (visual studio code)?

I wonder, if there is way to rename multiple files in visual studio code? I have tried to use find and replace, no luck.
Here is how you can do it on Mac. Right-click (or ctrl+click or click with two fingers simultaneously on the trackpad if you are using a MacBook) on the folder that contains the files that you want to have renamed. Then click Reveal In Finder. Then from within finder select all files you want to rename, right-click the selected files and choose Rename X items.... Then you will see something like this:
Insert the string you want to find and the string with which you want to replace that found string and hit rename. Done 🔨
There are a few Visual Studio Extensions that try to provide this functionality.
The first two I tried did not appear to work. There is an extension called Batch Rename which worked for me: https://marketplace.visualstudio.com/items?itemName=JannisX11.batch-rename-extension.
Here is how the extension works.
You highlight the files in the explorer, right-click, and select Batch Rename
The extension creates a text file with the names of the files you want to rename, one each line. Update the text file with the new names
Save the temporary text file from step 2 and the extension performs the rename.
VS Code only supports single file name. On Windows, to do batch rename, you can use one of the following
[CMD]
// Change the extensions of all .doc files to .txt
ren *.doc *.txt
// Replace the first three characters of all files starting with 'abc' by 'xyz'
ren abc* xyz*
[PowerShell]
Get-ChildItem *.txt | Rename-Item -NewName { $_.Name.Replace('.txt','.log') }
A comprehensive tutorial can be found here
brew install rename
rename s/foo/bar/g **/*
Not an option for Visual Studio Code (yet)...
...but in Sublime Text with the dired package you can enter rename mode with Shift + R.
This gives you a buffer with each file on its line:
D:\path\to\myfolder
first.file
second.file
third.file
...
umpteenth.file
Rename files by editing them directly, then:
Ctrl+Enter = apply changes
Ctrl+Escape = discard changes
While in rename mode you can use the full power of the text editor: edit all filenames at once with multiple cursors, transpose strings (to accomplish switch renames in one fell swoop), find and replace, the Text Pastry package can give you number ranges etc.
vscode-dired will not let you do this, renames are one by one.
You can not rename several files at the same time in vscode,.
The simplest way I found is using the free "everything" utility, it takes seconds to rename a bunch of files in one or several folders.
Open "everything" and filter the file list.
Select the files you want to change
pick "Change Name" with rButtom
Popup will display with old list, the new list, the old names and the new names, if you change the new name, the new list will change accordingly.
VS Code has no such type of facility yet or extension on it. But using vs code terminal as a cmd and run this command on the folder where you want to change all file names from one to another like I want to change my all view files from HTML to PHP.
rename *.html *.php
Renaming multiple files with a single shot is also called batch renaming.
This can't be done from within Visual Studio Code.
There are two ways to get what you want:
(A) Rename files one by one
Go to the Explorer view in VS Code's Side Bar.
Select a file you want to rename.
Press F2 or choose Rename from that file's context menu.
Continue with step 2 as long as there are files you want to process.
(B) Batch rename multiple files using other tools
Go to the Explorer view in VS Code's Side Bar.
Select a file you want to rename.
Press Alt+Ctrl+R or choose Open Containing Folder from that file's context menu.
This brings up the file explorer of your operating system.
Batch rename the files from there. How this is done in detail is beyond the scope of this answer (most of the time, it is just selecting all files to process and starting the rename-tool).
Perhaps the easiest more detailed way is by using VSCode Terminal tab (Ctrl/Cmd + J) and selecting from the dropdown menu the Powershell option:
Based on Kin's answer and the resource Kin provided (2nd page), in order to look into the current and all sub-folders, these are some useful renaming possibilities:
Extensions rename
ls -R *.txt | Rename-Item -NewName {[io.path]::ChangeExtension($_.name, "log")}
Selects txt files and renames their extensions to log.
Name+extension rename
Get-ChildItem -R *.txt | Rename-Item -NewName {$_.name.Replace('.txt','-text.log')}
Selects txt files and renames them to [ORIGINAL_NAME]-text.log.
NEW_NAME+NUMBER+extension rename (original names are discarded)
Get-ChildItem -R *.txt | %{Rename-Item $_ -NewName ("NEW_NAME-{0}.log" -f $nr++)}
Selects txt files and renames them to [NEW_NAME]-NUMBER.log.
How it works:
ls, an alias of the Get-ChildItem command (equivalent in Powershell), lists current directory files;
-R option allows the recursive lookup to happen;
listing result is piped into a multiple Rename-Item commands invocation.
You can rename a statement "in all files" highlighting it and then pressing "CTRL+R" and "CTRL+R"(again). That will replace the selected word/statement in the entire file and (if you don't disable the tooltip checkbox) in all other files where it matches.
I'm not sure if this answer your question, because this is for the text inside the files, not for the filenames.

How can I change the file sorting of VS Code?

In my project I have files labeled as such day1.txt, day2.txt, day3.txt, etc.
Now in my normal file system they are listed in the correct order:
day1.txt
day2.txt
....
day10.txt
day11.txt
In VS Code they are listed like so:
day1.txt
day10.txt
day11.txt
day2.txt
day3.txt
Is there a setting somewhere to change this? It is driving me mad.
I've given the settings a search and I didn't see any obvious parameter to change that would affect this.
Yes there is a way.
In your Settings (File → Preferences → Settings) search for: explorer.sortOrder
A small pen will appear on the left side of the setting. Select the way you want to sort the files. There are five options available:
Default
Mixed
Files first
Type
Modified
Unfortunately, there's no option that will allow you to sort all of the open editors alphabetically.
No, unfortunately there's no such option as of yet, but there's already a feature request.
Maddening having to constantly search for the file in the OPEN EDITORS section. Such a nice program otherwise. What a shame.

Beyond Compare Ignore Unimportant Differences in all files

I am using Beyond Compare 3.3.4.
I want to compare a large number of files and ignore unimportant differences.
In Session -> Session Settings -> Comparison tab, the "Requires opening files" section has a "Compare contents - Rules-based comparison". This does what I want when I open each file individually. The "quick test" section doesn't have this option. How do I apply rules-based comparisons to my "quick test"?
EDIT:
I am having the same problem as the original poster here. The answer given was "You can change this by going to the Session menu and changing your Comparison Criteria to use Rules-based content". Problem is, the "Rules-based comparison" is under the "Requires opening files" section, so this doesn't work. How do I fix this?
This answer describes the behavior of 3.3.4 (and 3.3.8) for Windows 32-bit, which seems to automatically report folder results as if I'd opened each file, as long as I have my session settings correct.
To perform a comparison that ignores unimportant differences, it is necessary to compare the file contents. BC3 can't know if line endings are the only difference (for example) unless it scans the contents for line endings. Therefore, you must set the "Compare contents" checkbox under the "Requires opening files" section. By doing so, the folder comparison automatically scans all file contents, I don't have to open each one individually.
A "quick test", by definition, is based solely on directory information like timestamp and size. It is quick because it does not open nor read the files; so if quickness is what you desire in a comparison, it cannot be rules-based. The concepts are incompatible.
You can see whether a "quick" or "contents" comparison has been run for any pair of files in a folder-compare window by looking at the middle column. If it is blank, only a quick test has been run; if there is an icon, a contents test has also been run.
That icon will be a black ≈ ("almost equal") symbol, two wavy lines, when a "Rules-based comparison" has detected only unimportant differences. The files themselves will be black and treated as matching if you have "View > Ignore Unimportant Differences" active, otherwise they'll be red or gray and treated as mismatching.
For the meaning of each possible icon, here is the relevant section from the Beyond Compare 3 help file:
Please find below screenshot. Hope this will help.

How to automatically expand empty packages in Eclipse with hierarchical presentation?

I have been often working on projects with huge namespaces on Eclipse.
Since I think that hierarchical package presention seems more visually helpful, I have the issue of selecting every package until the core classes, for example:
-br
-br.com
-br.com.company
-br.com.company.server.core
-br.com.company.server.core.web.common
-br.com.company.server.core.web.common.Utils.java (yay!)
Is there a way to automatically and recursivelly expand empty packages when using hierarchical package presentation?
So, when I click
+br
It would expand to:
-br
-com
-company
-server
-core
-web
-common
+Utils.java
Use the "Project explorer" view and change the "Package Presentation" from "Flat" to "Hierarchical". You find this setting in the view's menu.
For me, the hierarchical representation flattens multiple empty directories (e.g.: com.company.project) into one expandable and collapsible entry. The one trick I found that causes this to NOT be true (on OSX anyway) is that .DS_Store files will cause Eclipse to see the directory as "not empty". It then won't compress them into one entry. Removing these files (and any other hidden but present files in the directory) resolves this issue.
I can thus have com.company.project expandable with one click and all the packages appear hierarchically under it. It's a nice combination of the two views!