How to Remove All .Svn Directories from My Application Directories

How to remove all .svn directories from my application directories

Try this:

find . -name .svn -exec rm -rf '{}' \;

Before running a command like that, I often like to run this first:

find . -name .svn -exec ls '{}' \;

Command to recursively remove all .svn directories on Windows

Use the svn export command to export a Subversion working copy into a new "clean" directory structure that doesn't have the .svn directories.

How do you remove Subversion control for a folder?

Also, if you are using TortoiseSVN, just export to the current working copy location and it will remove the .svn folders and files.

http://tortoisesvn.net/docs/release/TortoiseSVN_en/tsvn-dug-export.html#tsvn-dug-export-unversion

Updated Answer for Subversion 1.7:

In Subversion 1.7 the working copy has been revised extensively. There is only one .svn folder, located in the base of the working copy. If you are using 1.7, then just deleting the .svn folder and its contents is an easy solution (regardless of using TortoiseSVN or command line tools).

How can I delete .svn folders from an app when I have no access to repository

This probably doesn't belong on SO, but... Iterating through the directories and deleting them is your only option, but this can usually be done quite easily. In Windows, use the search assistant (F3) to find the .svn directories, select them all, hit delete. On Linux or Mac OS, find . -name .svn | xargs rm -rf .

remove all .svn files and folder using php

I get a solution here it is

copied from lateralcode with little modification

$path = $_SERVER['DOCUMENT_ROOT'].'/work/remove-svn-php/'; // path of your directory 
header( 'Content-type: text/plain' ); // plain text for easy display

// preconditon: $dir ends with a forward slash (/) and is a valid directory
// postcondition: $dir and all it's sub-directories are recursively
// searched through for .svn directories. If a .svn directory is found,
// it is deleted to remove any security holes.
function removeSVN( $dir ) {
//echo "Searching: $dir\n\t";

$flag = false; // haven't found .svn directory
$svn = $dir . '.svn';

if( is_dir( $svn ) ) {
if( !chmod( $svn, 0777 ) )
echo "File permissions could not be changed (this may or may not be a problem--check the statement below).\n\t"; // if the permissions were already 777, this is not a problem

delTree( $svn ); // remove the .svn directory with a helper function

if( is_dir( $svn ) ) // deleting failed
echo "Failed to delete $svn due to file permissions.";
else
echo "Successfully deleted $svn from the file system.";

$flag = true; // found directory
}

if( !$flag ) // no .svn directory
echo 'No .svn directory found.';
echo "\n\n";

$handle = opendir( $dir );
while( false !== ( $file = readdir( $handle ) ) ) {
if( $file == '.' || $file == '..' ) // don't get lost by recursively going through the current or top directory
continue;

if( is_dir( $dir . $file ) )
removeSVN( $dir . $file . '/' ); // apply the SVN removal for sub directories
}
}

// precondition: $dir is a valid directory
// postcondition: $dir and all it's contents are removed
// simple function found at http://www.php.net/manual/en/function.rmdir.php#93836
function delTree( $dir ) {
$files = glob( $dir . '*', GLOB_MARK ); // find all files in the directory

foreach( $files as $file ) {
if( substr( $file, -1 ) == '/')
delTree( $file ); // recursively apply this to sub directories
else
unlink( $file );
}

if ( is_dir( $dir ) ){
//echo $dir;
// die;
rmdir( $dir ); // remove the directory itself (rmdir only removes a directory once it is empty)

}
}

// remove all .svn directories in the
// current directory and sub directories
// (recursively applied)
removeSVN($path);

Is there a way to delete all directories with the same name?

The small help popup says that masks ending in / will find folders, so I tried .svn/ and it does find that in the current folder. But it does not search recursively in sub folders.

Since you are using WinSCP you probably have Bash or SSH access too, you could try one of the scripts mentioned in this Stackoverflow question: How to remove all .svn directories from my application directories

a way to mask/remove .svn directories from war exported from eclipse

Go to the project properties, Java Build Path, select the Source tab. For each source directory, there are Included: and Excluded: lines. Put a pattern into the exclusions (something like **/.svn).

What happens is that the builder copies anything that isn't a Java source file into the output folder as part of the build, unless it is in the exclusion list.

Remove .svn folders

You may also find the svn export command useful. This command exports a copy of your working tree without the .svn folders.

This comes pretty handy if you develop under the Subversion recommended tagging way, you can always export a tag, and then you'll have a better control over what revision is on production.

Removing .svn files from all directories

You can do a thing called an SVN Export to get the files without the .svn directories

http://svnbook.red-bean.com/en/1.7/svn.ref.svn.c.export.html

How do I delete all directories matching a pattern using SVN?

From here (for the 'additionally part'):

  1. Click on Window -> Preferences
  2. Select Team -> Ignored Resources
  3. Click on Add Pattern and enter "bin"
  4. Click on Apply and then OK

For the bin directories, do you have svn 1.5 ?

Because if you do, 'svn rm --keep-local' allows to pull them from version control but not delete it from your machine.

You can do it with Tortoise (Delete (keep local))



Related Topics



Leave a reply



Submit