?
Solved

Automate script to delete folders in Windows Vista

Posted on 2011-03-10
5
Medium Priority
?
379 Views
Last Modified: 2012-05-11
Hi,

I'd like to create a simple script in Windows Vista to delete .svn folders recursively in all subfolders of C:\wamp\www\discoup9_v3

Here's a snapshot:
http;//tutorialref.com/images/delete-svn-folders-script-windows-vista.png

I'm using Vista Home Premium.

Thanks,
Victor
0
Comment
Question by:Victor Kimura
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 12

Expert Comment

by:prashanthd
ID: 35094045
Try the following code.

You may require elevated privileges in Vista

http://www.lytebyte.com/2008/10/22/how-to-run-as-administrator-in-vista-command-line/
On Error Resume next

Set objFSO = CreateObject("Scripting.FileSystemObject")
objStartFolder = "C:\wamp\www\discoup9_v3"

Set objFolder = objFSO.GetFolder(objStartFolder)

ShowSubfolders objFSO.GetFolder(objStartFolder)

Sub ShowSubFolders(Folder)
    For Each Subfolder In Folder.SubFolders
        'WScript.Echo Subfolder.Path
       		If Subfolder.name = ".svn" Then
       			'WScript.Echo Subfolder.Path
       			Err.Clear
       			objfso.DeleteFolder subfolder.path,True
       			If Err.Number<>0 Then
       				WScript.Echo subfolder.path &" - Err Number:"& Err.Number & " Err Description: " & Err.Description 
       			End if
       		End If
        	ShowSubFolders Subfolder
    Next
End Sub

Open in new window

0
 
LVL 56

Expert Comment

by:Bill Prew
ID: 35099379
Why not just do the following either at a command prompt, or in a BAT file?

DEL /S /Q "C:\wamp\www\discoup9_v3\*.svn"

Open in new window

~bp
0
 
LVL 12

Accepted Solution

by:
prashanthd earned 2000 total points
ID: 35108102
0
 

Author Comment

by:Victor Kimura
ID: 35110303
Hi billprew,

It's stating access denied. I'm logged in as admin and ran the cmd as admin.

-----------
To prashanthd,

I grabbed the code from the 2nd link (http://www.technospot.net/blogs/how-to-remove-svn-folders-from-your-source-files/). What code is the following? How do I run it in Vista?

FileSelectFolder, folder, %A_Desktop%
Loop, %folder%\*.*, 2, 1
{
	FileFullPath := A_LoopFileLongPath
	IfInString, FileFullPath, .svn
		FileRemoveDir, %FileFullPath%, 1
}

Open in new window


----
To prashanthd,

With regards to the code you gave, how do I run that code? Do I need a VB editor and run it from the development environment?

BTW, this link:
http://tomgilkison.blogspot.com/2008/07/delete-svn-folders-windows-vista.html

simply stated to use advanced search and delete them and I think that works. I just want to know how the code you gave works and how to run it.

Much thanks,
Victor

0
 
LVL 12

Assisted Solution

by:prashanthd
prashanthd earned 2000 total points
ID: 35111004
http://www.technospot.net/blogs/how-to-remove-svn-folders-from-your-source-files/
Do not run the code, right above the code on the download webpage, there is a link svnremover, download the tool and run.

http://tomgilkison.blogspot.com/2008/07/delete-svn-folders-windows-vista.html

The above link also states that advanced search will not work for Vista, you can try it.

As mentioned in above link

Copy the text and paste it into a text file called 'svn.reg'. Save the file and open it to add these keys to your registry. Then all you have to do is right-click on the folder and choose "Delete SVN Folders". It's even easier than the Search and Delete method :)

Copy the below lines from Windows Registry Editor Version 5.00 into svn.reg and follow above instructions


Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell\DeleteSVN]
@="Delete SVN Folders"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell\DeleteSVN\command]
@="cmd.exe /c \"TITLE Removing SVN Folders in %1 && COLOR 9A && FOR /r \"%1\" %%f IN (.svn _svn) DO RD /s /q \"%%f\" \""

0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

OfficeMate Freezes on login or does not load after login credentials are input.
A quick guide on how to use Group Policy to create a custom power plan and set it active on Windows 7.
This Micro Tutorial will teach you the basics of configuring your computer to improve its speed. It will also teach you how to disable programs that are running in the background simultaneously. This will be demonstrated using Windows 7 operating…
This Micro Tutorial will give you basic overview of the control panel section on Windows 7. It will depth in Network and Internet, Hardware and Sound, etc. This will be demonstrated using Windows 7 operating system.
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question