Sunday, June 21, 2020

How to move files from all the sub directorys to another which dont no the directory name

I had an issue where I need to move some files from one folder to another folder but the challenge was the source folder name get change time to time.
Basically the folder name will be a random GUID.

So I was unable to stick to a simple windows batch command because I don't n know the exact source folder name where my files available.

So this is a simple solution for that.
Just download the below EXE file and pass the arguments as it shows.

Basically what it does was extract everything from subfolders (what ever the sub folder name) on a given folder and place them on another folder.

https://drive.google.com/file/d/1v-JbHRvzXdfpMYfpZoAvEetLx2Bdzi4E/view?usp=sharing

MoveFiles.exe "source folder where your files stay" "Target folder where you want to move the files" "what kind of file extensions you need to move"

MoveFiles.exe "C:\Development\XXX\XXX" "C:\Development\XXX\XXX"  "*.XXX"


Thursday, June 18, 2020

Dotnet Code Coverage for SonaQube

It's not that much hard.
If you are with dot net 2.0 or above then just execute the below command on your test project location.

(where the XXX.Test.csproj available.)

1).dotnet test --collect "Code Coverage"

Then the tests will get to execute and at last there will be a coverage file available as on the test result folder.

Attachments:
  C:\Program Files (x86)\Jenkins\workspace\Backend Dev\test\Api.Test\TestResults\88de1678-d457-4e6c-a3fd-2d5786cddc13\ar0_2020-06-18.10_24_43.coverage
Total tests: 132. Passed: 66. Failed: 57. Skipped: 9.
Test Run Failed.
Test execution time: 44.3640 Seconds

Then convert the .coverfile to coveragexml file using below command.

2).CodeCoverage analyze /output:VisualStudiot.coveragexml  ar0_2020-06-18.10_24_43.coverage

You can use below nuget command to download the CodeCoverage packages.

dotnet add package Microsoft.CodeCoverage --version 16.6.1


The just point the newly created coveragexml file to sonar server by below code.

3).sonar.cs.vscoveragexml.reportsPaths=C:/Development/VisualStudiot.coveragexml