If it is used what is the difference between svnadmin hotcopy and xcopy? And how can I run xcopy command for each repository in ReposFolder in windows batch file? My assumption is if it is useful to backup svn repository I can just xcopy ReposFolder to backup every repository inside that directory. Thanks in advance for your help.
Yes, you can use xcopy or even better Robocopy to copy the SVN repositories, SVN will still work as usual if retored back. BUT it is always recommended to use the SVN admin copy/load to backup as it is more reliable and backsup all the revisions and if the copy interrupted in between, you will be able to just overwrite the revisions where you left.
Below is the syntax for robocopy. check Robocopy /? for mode options.
robocopy /e c:\repositories \\backupserver\svncopy
Cheers, G
Related
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
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.
I want to use SCCM 2012 to distribute some files (not application, no executable there).
I know there is a way to create a batch file with xcopy command, and create a package to deploy that batch file to the clients. However, if I use xcopy I cannot leverage the BITS functionality and other benefits from SCCM.
Is this possible?
Hi I can see this is an old post, but I have used SCCM to copy files in the past.
A company I worked for in the past refused to use GP for any file copy (don't get me started) so I had to implement GP files over SCCM.
Here are some examples I used.
xcopy User.bmp "%ProgramData%\Microsoft\User Account Pictures" /c /y /r
REG ADD HKLM\Software\FILE_GP /v Copy_User_image /t REG_sz /d 1.0 /f
timeout 5
if not exist "%windir%\system32\oobe\Info\backgrounds" md "%windir%\system32\oobe\Info\backgrounds"
xcopy backgrounddefault.jpg "%windir%\system32\oobe\Info\backgrounds" /c /y /r
REG ADD HKLM\Software\File_GP /v Backgrounddefault /t REG_sz /d 1.0 /f
timeout 5
I had the script add the Registry key so I could use Application deployment and have the detection method look for the key as well as the file. So if a user deleted the file it would return.
The main reason for me to have the Reg Key was if you wanted to push an updated version of the file I could set the new copy script to push 1.1 to the reg key and have the detection look for that version, then I could retire the 1.0 version.
I found also for short scripts of 1 file of small size without the timeout line it would report failed immediately, if there were larger files I didn't need the timeout. The initial fail does clear after some time without the timeout line.
It should work if you chose your settings right.
In your batch make sure that all the paths and references are relative and never absolute.
Then when you create the deployment there is a point called "Distribution Points" where you can select the deployment options for fast as well as unreliable networks. There you would have to choose "Download content from distribution point and run locally" in both cases. Then your batch would basically copy the files from the CCM cache to the hard drive.
This method should work for packages, for applications I think it would be more difficult because you cannot directly specify deployment options for fast networks there.
Packages are downloaded to the clients with BITS by default. The XCOPY command would copy from CCMCACHE to final destination on the machine.
Not sure if you have tried it or not but if you have deployed any .exe file for application its ask for dependence file in that you mention your required file which need to copy and create a script to copy data from ccmcache to copy the data to destination folder. for this you can get the use of BITS and to check if the file are copied or not you can use a proper detection method.
I used a PowerShell script for this purpose and it works like charm.
Create a new script and change this one liner to your mods:
Copy-Item -Path "\\[NETWORK PATH]" -Destination "[DESTINATION PATH]" -Recurse
Other way around—if need to make a required package—could be to create a new application deployment and run this through PowerShell (ExecutionPolicy ByPass) and manually install from the client side; if you don't want user interaction, make it a required deploy.
I've came across several posts and even code online about .batch files to delete folders and files. However, I am still pretty confused by the myriad amount of information that's on the Internet. Is there a specific way of writing a script that automatically deletes folders that are older than 30 days (the script has to be smart enough to run itself and not be done manually)
I appreciate your help and I am willing to learn here. Thanks!
P.S. I've attached an example of the kind of folders that I would like to delete. As you can see these folders date back to 2008
This will remove the entire directory tree, so use it with coution and remove the echo, if the output is OK:
forfiles /d -30 /c "cmd /c if #isdir==TRUE echo rd /s /q #fname"
Scripts can not run them selves automatically, but the os provides facilities to do that using scheduled tasks. So you need to create yourself a batch file to delete what you need and then add a recurring scheduled task to do the work.
There is no built-in batch command to work only on files with a certain age. But you can download the forfiles tool from Microsoft. It allows to execute commands on files of a certain age only (on the command line).
I am trying to create a script on Windows which when run on an admin PC:
Copies a folder from the admin PC into a group of network PCs by specifying the ip address / range
For each destination PC, Navigate into the folder and run another script file.
Using the method described by seanyboy here:
net use \\{dest-machine}\{destfolder} {password} /user:{username}
copy {file} \\{dest-machine}\{destfolder}
I'm not sure on how i can write a 'for' loop to go through each 'dest-machine' and perform step 2. Any ideas would be greatly appreciated.
check Robocopy:
ROBOCOPY \\server-source\c$\VMExports\ C:\VMExports\ /E /COPY:DAT
make sure you check what robocopy parameter you want. this is just an example.
type robocopy /? in a comandline/powershell on your windows system.
Below command will work in command prompt:
copy c:\folder\file.ext \\dest-machine\destfolder /Z /Y
To Copy all files:
copy c:\folder\*.* \\dest-machine\destfolder /Z /Y
Why for? What do you want to iterate? Try this.
call :cpy pc-name-1
call :cpy pc-name-2
...
:cpy
net use \\%1\{destfolder} {password} /user:{username}
copy {file} \\%1\{destfolder}
goto :EOF
Regarding step 2., check manual for psexec command (sysinternal tools)
I have two code bases of an application. I need to copy all the files in all the directories with .java from the newer code base, to the older (so I can commit it to svn).
How can I write a batch files to do this?
XCOPY /D ?
xcopy c:\olddir\*.java c:\newdir /D /E /Q /Y
If you've lots of different instances of this problem to solve, I've had some success with Apache Ant for this kind of copy/update/backup kind of thing.
There is a bit of a learning curve, though, and it does require you to have a Java runtime environment installed.
I like Robocopy ("Robust File Copy"). It is a command-line directory replication command. It was available as part of the Windows Resource Kit, and is introduced as a standard feature of Windows Vista and Windows Server 2008.