How can I use simian clone detection tool? - clone

How can I use simian clone detection tool? Can anyone help me, please?
-Saidur

Here is the script we're using:
DEL /s /f /q simian.xml
D:\Simian\simian.exe -formatter=xml:simian.xml -includes=**\*.cs -excludes=**\*.Generated.cs -excludes=**\*.g.cs -excludes=**\*.Designer.cs "-excludes=**\Service References\**\*.cs" -excludes=**\*Tests.cs
exit 0

Related

How to get a list of all subfolders sorted by date?

Is there any way to do that? Maybe some external program?
dir "d:\Folder" /ad /b /o:-d /s
Sorting is not working with "/s" and folders for me.
Compared to Unix-Shells the Windows Command Line Interface isn't very powerful. Windows PowerShell might be better for you, if Windows is mandatory for you. See this page for example.
OK I found an easy way to do this.
I just searched for "kind:folders" and sorted them by date.

How to solve "The directory is not empty" error when running rmdir command in a batch script?

I am making a batch script and part of the script is trying to remove a directory and all of its sub-directories. I am getting an intermittent error about a sub-directory not being empty. I read one article about indexing being the culprit. I disabled WSearch but I eventually got the error again. Here's the command:
rmdir /S /Q "C:\<dir>\"
I experienced the same issues as Harry Johnston has mentioned. rmdir /s /q would complain that a directory was not empty even though /s is meant to do the emptying for you! I think it's a bug in Windows, personally.
My workaround is to del everything in the directory before deleting the directory itself:
del /f /s /q mydir 1>nul
rmdir /s /q mydir
(The 1>nul hides the standard output of del because otherwise, it lists every single file it deletes.)
I'm familiar with this problem. The simplest workaround is to conditionally repeat the operation. I've never seen it fail twice in a row - unless there actually is an open file or a permissions issue, obviously!
rd /s /q c:\deleteme
if exist c:\deleteme rd /s /q c:\deleteme
I just encountered the same problem and it had to do with some files being lost or corrupted. To correct the issue, just run check disk:
chkdsk /F e:
This can be run from the search windows box or from a cmd prompt. The /F fixes any issues it finds, like recovering the files. Once this finishes running, you can delete the files and folders like normal.
enter the Command Prompt as Admin and run
rmdir /s <FOLDER>
I had a similar problem, tried to delete an empty folder via windows explorer. Showed me the not empty error, so I thought I try it via admin cmd, but none of the answers here helped.
After I moved a file into the empty folder. I was able to delete the non empty folder
As #gfullam stated in a comment to #BoffinbraiN's answer, the <dir> you are deleting itself might not be the one which contains files: there might be subdirectories in <dir> that get a "The directory is not empty" message and the only solution then would be to recursively iterate over the directories, manually deleting all their containing files... I ended up deciding to use a port of rm from UNIX. rm.exe comes with Git Bash, MinGW, Cygwin, GnuWin32 and others. You just need to have its parent directory in your PATH and then execute as you would in a UNIX system.
Batch script example:
set PATH=C:\cygwin64\bin;%PATH%
rm -rf "C:\<dir>"
Im my case i just moved the folder to root directory like so.
move <source directory> c:\
And then ran the command to remove the directory
rmdir c:\<moved directory> /s /q
I had "C:\Users\User Name\OneDrive\Fonts", which was mklink'ed ( /D ) to "C:\Windows\Fonts", and I got the same problem. In my case
cd "C:\Users\User Name\OneDrive"
rd /s Fonts
Y (to confirm the action)
helped me. I hope, that it helps you too ;D
What worked for me is the following. I appears like the RMDir command will issue “The directory is not empty” nearly all the time...
:Cleanup_Temporary_Files_and_Folders
Erase /F /S /Q C:\MyDir
RMDir /S /Q C:\MyDir
If Exist C:\MyDir GoTo Cleanup_Temporary_Files_and_Folders
The reason rd /s refuses to delete certain files is most likely due to READONLY file attributes on files in the directory.
The proper way to fix this, is to make sure you reset the attributes on all files first:
attrib -r %directory% /s /d
rd /s %directory%
There could be others such as hidden or system files, so if you want to play it safe:
attrib -h -r -s %directory% /s /d
rd /s %directory%
Windows sometimes is "broken by design", so you need to create an empty folder, and then mirror the "broken folder" with an "empty folder" with backup mode.
robocopy - cmd copy utility
/copyall - copies everything
/mir deletes item if there is no such item in source a.k.a mirrors source with
destination
/b works around premissions shenanigans
Create en empty dir like this:
mkdir empty
overwrite broken folder with empty like this:
robocopy /copyall /mir /b empty broken
and then delete that folder
rd broken /s
rd empty /s
If this does not help, try restarting in "recovery mode with command prompt" by holding shift when clicking restart and trying to run these command again in recovery mode
one liner:
if exist folder rmdir /Q /S folder
I'm using this in a NPM script like so (Javascript) :
//package.json
"scripts": {
"start": "parcel --no-cache",
"clean": "if exist dist rmdir /Q /S dist",
"deploy": "npm run clean && parcel build --no-source-maps && firebase deploy"
},
Open CMD as administrator
chkdsk c: /F /R
Press the “Y” key if asked to check your disk the next time your system restarts.
Restart the machine. After that just delete the folder.
The easiest way I found to do this is:
rm -rf dir_name
it worked on zsh - macOS, it should work on windows cmd as well.
if you need to delete a folder on Windows with a batch file you will need to use PowerShell and this is how it is done:
rmdir .\directory_name\ -Recurse
Similar to Harry Johnston's answer, I loop until it works.
set dirPath=C:\temp\mytest
:removedir
if exist "%dirPath%" (
rd /s /q "%dirPath%"
goto removedir
)
Force delete the directory (if exists)
Delete.bat
set output_path="C:\Temp\MyFolder"
if exist %output_path% (
echo Deleting %output_path%
attrib -r /s /d %output_path%
rd /s /q %output_path%
)
I've fixed this before my making sure there wasn't extra whitespace in the name of the directory I was deleting. This is more of a concern when I had the directory name contained within a variable that I was passing to RD. If you're specifying your directly in quotes then this isn't helpful, but I hope that someone like me comes along with the same problem and sees this. RD /S /Q can work, as I noticed the issue started happening when I changed something in my batch script.
I can think of the following possible causes:
there are files or subdirectories which need higher permissions
there are files in use, not only by WSearch, but maybe by your virus scanner or anything else
For 1.) you can try runas /user:Administrator in order to get higher privileges or start the batch file as administrator via context menu. If that doesn't help, maybe even the administrator doesn't have the rights. Then you need to take over the ownership of the directory.
For 2.) download Process Explorer, click Find/Find handle or DLL... or press Ctrl+F, type the name of the directory and find out who uses it. Close the application which uses the directory, if possible.

batch script to disable/move/delete multiple computers in AD

I'm currently working in an organization that has migrated their OU groups so that everything belongs to a parent folder called "users and workstations".
This is a slight problem for me, as I have a few batch scripts that delete users and computers from a text file - something that I run fairly regularly.
The current code I use, for example, to disable a batch of machines is below
#echo off
CLS
ECHO Now Disabling Machines...
TIMEOUT 2 > nul
Pause
FOR /f %%i in (%~dp0\computernames.txt) do (
dsquery computer -name %%i | dsmod computer -disabled Yes
)
If I run this code since the change, I get the following error
dsmod failed:'Target object for this command' is missing.
type dsmod /? for help.
However, if I manually type the dsquery / dsmod line of code into command prompt and replace the "%%i" with a computer that failed, it succeeds.
I'm almost certain that this is due to the spaces within the OU folder structures, but don't know what to do to change my script to continue working.
Is there a way to change it? should I try something else? I'm going crazy trying to figure this out!!!
Thanks in advance,
Ben
P.S. I've come up with a solution that seems to work - I'll keep this open incase anyone can suggest a better way to do what i need to do. Please see below for the code that works for me. Looks like I needed to add correct delims and two sets of double-quotes to exit out correctly.... it doesn't make too much sense to me... but it works...
#echo off
setlocal disabledelayedexpansion
CLS
ECHO Now Disabling Machines...
ECHO.
Pause
FOR /f "delims= " %%i in (%~dp0\computernames.txt) do (
echo disabling %%i && echo. && dsquery computer -name ""%%i"" | dsmod computer -disabled Yes && echo.
)
Try using quotes on %%i in this line like this
dsquery computer -name "%%i" | dsmod computer -disabled Yes
Edit (added below):
Ahhhh... I bet the current directory is not what you think. Perhaps you are executing from a UNC drive. Try this:
pushd %~dp0
FOR /f %%i in (computernames.txt) do (
dsquery computer -name "%%i" | dsmod computer -disabled Yes
)
Please see original post for solution.
disabling delayed expansion and specifying the delims, along with double double quoting the variable seems to have fixed the problem!

Running executables using Windows batch files

I have an application in which I would like to run many executables using a batch file (in my case a program called AMDIS, http://chemdata.nist.gov/mass-spc/amdis/downloads/).
On the Windows command prompt it works if I type
C:\NIST08\AMDIS32\AMDIS_32.EXE C:\Users\Ento\Documents\GCMS\test_cataglyphis_iberica\queens\CI23_Q_120828_01.CD‌​F /S /E
where AMDIS_32 is the program I want to run and C:\Users\Ento\Documents\GCMS\test_cataglyphis_iberica\queens\CI23_Q_120828_01.CD‌​F the file I want it to analyze and /S /E some opions.
Now I would like to make these calls repeatedly using a batch file in Windows 7.
I tried making a batch file with
START C:\NIST08\AMDIS32\AMDIS_32.EXE C:\Users\Ento\Documents\GCMS\test_cataglyphis_iberica\queens\CI23_Q_120828_01.CD‌​‌​F /S /E
but this doesn't seem to work. Does anyone know how I should do this?
cheers,
Tom
EDIT: based on the info in forum http://social.msdn.microsoft.com/Forums/en-US/sqlexpress/thread/fdb993d9-6a9c-4459-aedb-0283f2d6935d I found that my mistake had to do with saving my batch file in UNICODE rather than ANSI encoding - now it works - thanks to you all!!
:X
C:\NIST08\AMDIS32\AMDIS_32.EXE C:\Users\Ento\Documents\GCMS\test_cataglyphis_iberica\queens\CI23_Q_120828_01.CD‌​F /S /E
goto X
#Echo OFF
Set /A "Interval=3"
PUSHD "C:\NIST08\AMDIS32"
:Loop
Start /B AMDIS_32.EXE "C:\Users\Ento\Documents\GCMS\test_cataglyphis_iberica\queens\CI23_Q_120828_01.CD‌​F" /S /E
Ping -n %INTERVAL% Localhost >NUL
Goto :Loop

Wildcard with cmd files

I am currently using this statement:
for /d %%X in (C:\Users\*) do (del %%X\Desktop\deleteme.txt )
Although I would like to use the "%%X" in to parts of this statement
e.g.
del %%X\%%X\deleteme.txt
How can this be done?
Any help would be greatly appreciated
It seems like you want to recursively delete files. This could be done by using the del command directly. By typing:
del deleteme.txt /s
deleteme.txt will be deleted from all subfolders. If that is not what you want you also could have your for loop call another batch file to perform the deletion from sub folders.
%%X will not work, as it gets fully expanded first.

Resources