How to delete files created with * - installation

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.

Related

How to start an application in a given directory, using other as its working dir?

For a system we are deploying for our customer we need to run the setup executable from %temp% and have it use for the installation, files in another directory.
This cannot be solved at the application level.
So, basically what I need it to somehow "cheat" the setup.exe located at %temp% to think it ran under another directory.
Any ideas?
I tried doing pushd & popd, that doesn't work because the OS tries to call setup.exe from the data files' directory, not setup.exe.
I also tried calling setup.exe by running a bat from the data files directory, that basically calls it by doing:
%temp%\setup.exe
doing:
cd %temp%
setup.exe
also failed
cd %files_dir%
%temp%\setup.exe
But
1) it's up to setup.exe to use current dir or not. So this command sequence can have no effect.
2) current dir can be changed at any moment (e.g. when system Files Open dialog is called).
You can try to create shrtcut of files in %temp% dir and use them instead of files. Maybe you'll need to play around with file extensions.

Populating empty folders recursively with Windows

I have a huge series of folders, named 'A' through 'Z' such that each folder has subfolders in the same form.
For example, I could have a directory at this path: .\A\D\E
I want to populate each of these folders with an empty file (so I can commit it to a git repository if anyone's curious).
Windows doesn't have an equivalent of Linux's touch, but I have the GnuWin32 toolset installed so I can, in fact, use touch in my Windows environment.
I've started by creating a batch file with the following:
FOR /D /r do touch empty
But when I run it, the folders aren't populated. I don't get any errors either:
C:\sandbox>FOR /D /r do touch empty
C:\sandbox>
Does anybody see anything glaringly wrong about the line of batch script above? Is there anything else I can try short of using additional non-Windows commands?
You just need to get the syntax of the FOR command right:
for /r %f in (.) do touch %f\empty

Windows cmd: Copy over entire directory *including* parent directory. Solution without specifying same parent directory name

In Windows, how do you copy an entire directory, INCLUDING the parent directory folder?
For instance, let's say we have the directory c:\Folder and want to copy it over to d: .
The only way right now would be:
xcopy /E c:\Folder d:\Folder
Is there a way to do this without specifying the same end directory (Folder)?
I'm told that an application called RoboCopy can do it, however, I believe it's part of a series of server 2003/2008 tools -- I can't speak to its capabilities or whether it will work on your version of Windows. That said, there are a set of tools (basically UNIX commands ported to DOS) located here that will do what you need -- specifically the "cp" command. My apologies for not being able to assist further.

Problem deleting .svn directories on Windows XP

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.

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