0

I have several php-projects under SVN control. I want to delete compiled php-template files after update on the client side; these files are located in ./tmp/smarty/compile folder. So using windows command line I can do this using

del /Q path_to_my_project\tmp\smarty\compile

If I run this command in cmd.exe all files are successfully deleted.

using projects properties tsvn:postupdatehook I should use %REPOROOT% placeholder for project path. so my command becomes:

del /Q %REPOROOT%\tmp\smarty\compile

del is the cmd.exe command, so I need to run cmd.exe first and then run desired command. so finally my hook command looks like:

cmd.exe /c del /Q %REPOROOT%\tmp\smarty\compile

when I run this using Win+R (with reporoot changed to full path) it works fine too.

Then I put this line to SVN properties (I should replace \ slashes to /, overwise SNV returns http-path to repository, not local path), and try to update project. TortoiseSVN asks me if I want to run hook:

cmd.exe /c  del /Q D:\_projects\webCakePHP\.....\tmp\smarty\compile

So here reporoot is successfully translated to correct working copy path. Everything looks fine, but when I run this hook, it successfully deletes files in tmp\smarty\compile but it also deletes all files from working copy dir.

the question is, what am I doing wrong, and how to delete files after update right way.

I've tried to put quotes some ways but it doesn't delete enything at all or says that there is no such directory.

thanks

teran
  • 3,214
  • 1
  • 21
  • 30
  • Perhaps it helps putting quotation marks around the path: `del /Q "%REPOROOT%\tmp\smarty\compile"`; otherwise, in case spaces or other token separators occur, `del` interprets it as multiple paths unexpectedly... – aschipfl Dec 19 '16 at 13:11
  • @aschipfl there are no spaces in path, but with such quotes it does nothing, as I remember. I tried to quote path and whole del command and double quote del-path with escaping :( – teran Dec 19 '16 at 14:04
  • Quoting paths does never harm, it just avoids trouble with whitespaces and avoids the need of escaping special characters... – aschipfl Dec 19 '16 at 22:06

1 Answers1

0

as an alternate solution to my question, i've created .bat file in %REPOROOT%/bin folder, which deletes files:

pushd %~dp0..\tmp\smarty\compile
del /Q *
popd

and my hook cmd string is %REPOROOT%/bin/clearCache.bat.

this is not exact answer to my question because it requires bat-file creation and isn't one-line hook.

teran
  • 3,214
  • 1
  • 21
  • 30