Problem deleting .svn directories on Windows XP - windows

I don't seem to have this problem on my home laptop with Windows XP, but then I don't do much work there.
On my work laptop, with Windows XP, I have a problem deleting directories when it has directories that contain .svn directories. When it does eventually work, I have the same issue emptying the Recycle bin. The pop-up window says "Cannot remove folder text-base: The directory is not empty" or prop-base or other folder under .svn
This continued to happen after I changed config of TortoiseSVN to stop the TSVN cache process from running and after a reboot of the system.
Multiple tries will eventually get it done. But it is a huge annoyance because there are other issues I'm trying to fix, so I'm hoping it is related.
'Connected Backup PC' also runs on the laptop and the real problem is that cygwin commands don't always work. So I keep thinking the dot files and dot directories have something to do with both problems and/or the backup or other process scanning the directories is doing it. But I've run out of ideas of what to try or how to identify the problem further.

You don't need to reboot; just open Task Manager and kill TSVNCache.exe.
This is safe, too. It's designed so you can kill it and it will automatically restart when needed.
(As a result of the auto-restart, note that browsing some SVN folders in Explorer, File-Open dialogs, etc. may cause TSVNCache.exe to restart. Keep an eye on Task Manager.)
Tortoise SVN is great but I have found that TSVNCache.exe can hold on to locks and get in the way at times. (Sometimes justified, sometimes not.) As a result, for some automated scripts I run I include commands to kill TSVNCache.exe as part of the scripts so it doesn't get in the way. That's only worth doing if it's an operation you perform often, though.

You can try a few things:
Since you are getting this error frequently, you can use handle.exe from sysinternals to check which process currently have open handles for the .svn\* directory. If handle utility tells you about any process, try stopping that process and then delete the directories.
Error while deleting from recycle bin: In simple terms, when a file is sent to recycle bin after deleting, it is not actually deleted, rather, a few manipulations are done in directory hierarchy (file system level) to avoid showing the file while browsing content of a folder. So If you happen to resolve the problem mentioned in comment#1, you will not get this error probably.
Cygwin command not working: Running a cygwin command on windows requires (in particular) cygwin1.dll, which is known to be shipped with other programs (eg: CopSsh, some version of svn clients etc...) as well. If there is any mismatch in the version of cygwin1.dll, cygwin commands won't work. Try searching for cygwin1.dll on your computer and try to resolve version conflicts (if any).

did you ever do mkpasswd and mkgroup for cygwin? If you're using cygwin from the command line you are pretty much guaranteed to have file system permissions issues. and you have to read a little to fix it.
http://cygwin.com/cygwin-ug-net/ntsec.html

Try this answer from me. Although it's given for TortioseGit instead of TortoiseSVN, the handling is the same:
disable the status cache (i.e. prevent the TSVNCache.exe from accessing the .svn folders continuously)
delete what you have to delete
enable the status cache to get updated overlays again

I have just experienced this problem (or similar)
I am using tortoise 1.6.7
To fix it I went to 'Tortoise Settings' from the tortoise context menu.
from there select "Icon Overlays" in the tree widget.
In the icon overlays page, I entered the path that was giving me angst into the "exclude paths:"and tortoise no longer holds that directory handle.
This is a directory that is often deleted by a process other than explorer.

Since what it appears that you are trying to do is export the repository from SVN, why not use the export functionality with TortoiseSVN. This removes all .svn directories from the generated 'working copy'.Cmdline: http://svnbook.red-bean.com/en/1.0/re10.html

If you want to delete all sub folders named .svn in windows
then create batch file with this content:
for /f "tokens=* delims=" %%i in ('dir /s /b /a:d *.svn') do (
rd /s /q "%%i"
)
save it in a file del_All_Dot_SVN_Folders.cmd . Run it. Your done.
Thanks to http://www.axelscript.com/2008/03/11/delete-all-svn-files-in-windows/
Remember the above code has .svn whereas the code in the link has only *svn so its better
to have the .svn to not accidentally have undesired effect.

Related

How to change SYMLINK to SYMLINKD in batch script

We're sharing SYMLINKD files on our git project. It almost works, except git modifies our SYMLINKD files to SYMLINK files when pulled on another machine.
To be clear, on the original machine, symlink is created using the command:
mklink /D Annotations ..\..\submodules\Annotations\Assets
On the original machine, the dir cmd displays:
25/04/2018 09:52 <SYMLINKD> Annotations [..\..\submodules\Annotations\Assets]
After cloning, on the receiving machine, we get
27/04/2018 10:52 <SYMLINK> Annotations [..\..\submodules\Annotations\Assets]
As you might guess, a file target type pointing at a a directory [....\submodules\Annotations\Assets] does not work correctly.
To fix this problem we either need to:
Prevent git from modifying our symlink types.
Fix our symlinks with batch script triggered on a githook
We're going we 2, since we do not want to require all users to use a modified version of git.
My limited knowledge of batch scripting is impeding me. So far, I have looked into simply modifying the attrib of the file, using the info here:
How to get attributes of a file using batch file and https://superuser.com/questions/653951/how-to-remove-read-only-attribute-recursively-on-windows-7.
Can anyone suggest what attrib commands I need to modify the symlink?
Alternatively, I realise I can delete and recreate the symlink, but how do I get the target directory for the existing symlink short of using the dir command and parsing the path from the output?
I think it's https://github.com/git-for-windows/git/issues/1646.
To be more clear: your question appears to be a manifestation of the XY problem: the Git instance used to clone/fetch the project appears to incorrectly treat symbolic links to directories—creating symbolic links pointing to files instead. So it appears to be a bug in GfW, so instead of digging it up you've invented a workaround and ask how to make it work.
So, I'd better try help GfW maintainer and whoever reported #1646 to fix the problem. If you need a stop-gap solution, I'd say a proper way would be to go another route and script several calls to git ls-tree to figure out what the directory symlinks are (they'd have a special set of permission bits;
you may start here).
So you would traverse all the tree objects of the HEAD commit, recursively,
figuring out what the symlinks pointing at directories are and then
fixup the matching entries in the work tree by deleting them
and recreating with mklink /D or whatever creates a correct sort of
symlink.
Unfortunately, I'm afraid trying to script this using lame possibilities
of cmd.exe-s scripting facilities would be an exercise in futility.
I'd take some more "real" programming language (PowerShell as an example,
and—since you're probably a Windows shop—even a .NET would be OK).

Synchronize windows folders

I have set up remote sync in my eclipse to copy jsp and js files at different locations. I am observing that sometimes because of this sync (I need to keep build auto option enabled) eclipse is hanging and I need to kill the process.In windows do we have any option to sync two local folders. I searched but options I am getting through third party software. I am using my office laptop, so don't want to use any third party software and want to check if windows provide any easy option for that.
I miss unix and rsync :(
Currently I am using a bat file to copy these files. I think robocopy is a good option too.
xcopy /s /d /y source folder destination foler
Fortunately, there is a useful little program in Windows called robocopy that ships with Win7 and above.
https://technet.microsoft.com/en-us/library/cc733145.aspx
robocopy <source> <destination> /mir /copyall
This is what you can use to copy a source directory to a target directory including all subdirectories, files, and metadata. It's uni-directional so won't check both ways, but there are time and change based triggers you can set with a windows startup task so you can make the folders auto-sync as you work.
If you read the link, you'll find the /mot: and /mon: flags which will watch the folders for changes/wait a certain amount of time then copy again.
In addition, it is really good at logging output, and is excellent when used as a system startup process.

How to delete files created with *

I'm creating an installer with NSIS which will install more than 100 files.
I know that to specify which files you want to install you can use
File /r ..\release\*
Which works very well.
But what should I do to uninstall these files ( Appart from using the Delete command individually for each file that I know that is installed. )
I've taken a look on RMDir which doesn't seem really safe to use. And also here which didn't work.
Thank you for your time
RMDir is safe. It's use of the /r flag that the doc warns about:
Warning: using RMDir /r $INSTDIR in the uninstaller is not safe.
Though it is unlikely, the user might select to install to the Program
Files folder and so this command will wipe out the entire Program
Files folder, including other programs that has nothing to do with the
uninstaller. The user can also put other files but the program's files
and would expect them to get deleted with the program. Solutions are
available for easily uninstalling only files which were installed by
the installer
Given this, I'd think you'd just manually remove any subdirectories, then delete the parent. The only case that I can think of where this wouldn't work is when your application is generating new folders dynamically. And if that's the case, even the uninstall log isn't going to help you there.
It's also perfectly okay to use /r on a subdirectory that you created. The concern is deletion of the top-level install directory, and everything that may have existed in it. If your installer rolls out a folder with additional assets called images, which also contains subdirectories, there's no reason why
RMDir /r $INSTDIR\images`
would be dangerous.

Why does mkdir occasionally give Access Denied?

I have BAT scripts which are nothing tricky and work fine on XP. But on Win 7, about 1 in 5 executions of mkdir following rmdir give a mystery Access Denied. E.g.
S:\TLIB importing\! Curtains\2 To process>rmdir temp3allout /s /q
S:\TLIB importing\! Curtains\2 To process>mkdir temp3allout
Access is denied.
After this, when I try in Explorer, it has no problem making that directory. Running thatBAT again usually succeeds.
Any idea what's going on here?
Win XP disc was a regular 2Gb drive. Win 7 disc is a 2Gb Intel RST RAID1 array with caching and flushing disabled http://i.imgur.com/Ohqkg2t.png .
This happens when the file system hasn't finished deleting the directory yet.
Sometimes this will happen synchronously, i.e., before the rmdir command completes, but sometimes there will be a very short but nonzero delay. (In XP it was always synchronous, IIRC.)
If possible, avoid deleting and immediately recreating directories; if you can't avoid it, you'll need to detect the failure and retry.
You should probably also test and if necessary retry the rmdir; sometimes rmdir runs into the same problem and fails to delete the entire directory tree.
Because that directory or file in that directory is open in some editor,first you have to close that file/directory from editor and then try.
These error usually comes when we create some directory and then delete it,but it is partially deleted and we create new directory with same name.

build.exe and cleaning?

I'm working on some driver development and using Microsoft's build.exe tool from the WDK 6001 (Vista). I'd like to be able to clean up all the object and intermediate files it spews out on every iteration.
So far, I've found "build.exe -0 -c" works relatively well, by simply deleting all the .obj files, but none of the .sbr files or directories it created. I'd really like to avoid writing a makefile as another makefile would be hard to integrate into the build system.
How can I do this?
Have you though of a scripting language to to a recursive delete. We use Nant for our build system, and that has this type of thing built in.
A more windows answer might be to use powershell which you should be able to call from your makefile.
Or you could just revert to DOS commands. Thus
dir /S *.sbr
Shows me all my nested sbr files, and then
del /S *.sbr
deletes then all. And can be shown to have worked via the dir command again.

Resources