<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>TheTobers.net &#187; File Names</title>
	<atom:link href="http://thetobers.net/tag/file-names/feed/" rel="self" type="application/rss+xml" />
	<link>http://thetobers.net</link>
	<description>Atlanta Tobers</description>
	<lastBuildDate>Sat, 05 Nov 2011 15:01:11 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Renaming multiple folders</title>
		<link>http://thetobers.net/2009/03/recursive-folder-renaming/</link>
		<comments>http://thetobers.net/2009/03/recursive-folder-renaming/#comments</comments>
		<pubDate>Mon, 09 Mar 2009 17:26:50 +0000</pubDate>
		<dc:creator>rtober</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[File Names]]></category>
		<category><![CDATA[Photos]]></category>
		<category><![CDATA[vbscript]]></category>

		<guid isPermaLink="false">http://www.thetobers.net/?p=471</guid>
		<description><![CDATA[I might go a few weeks or months before I download photos from our various digital cameras. I sort all my images into daily folders but the organization/connection software I use doesn&#8217;t allow me to create folder names with the structure I prefer (I hate spaces in file/folder names). I might end up with 50+ &#8230; </p><p><a class="more-link block-button" href="http://thetobers.net/2009/03/recursive-folder-renaming/">Continue reading &#187;</a>]]></description>
			<content:encoded><![CDATA[<p><span class="dropcap">I</span> might go a few weeks or months before I download photos from our various digital cameras. I sort all my images into daily folders but the organization/connection software I use doesn&#8217;t allow me to create folder names with the structure I prefer (I hate spaces in file/folder names).  I might end up with 50+ total folders (or more) that I have to rename manually &#8211; needless to say, it&#8217;s a time consuming hassle.</p>
<p><span id="more-471"></span><br />
I just needed a small script to run a character string search on each sub folder (recursive) and replace one string with another.  Not complicated at all but definately not worth $20-40 for a commercial application that wraps vbscript/batch processing in a neat UI shell.  A little help from Google and some quick research on folder/file objects within vbscript and I came up with a solution that works perfectly:</p>
<blockquote><p>
Dim Folder_input, Find_Str, Replace_Str</p>
<p>Folder_input = inputbox(&#8220;Enter the root folder path:&#8221; &#038; vbcrlf &#038; &#8220;e.g. C:\wutemp&#8221;)<br />
If Folder_input = &#8220;&#8221; then App_Quit</p>
<p>Find_Str = inputbox(&#8220;Search for:&#8221;)<br />
If Find_Str = &#8220;&#8221; then App_Quit</p>
<p>Replace_Str = inputbox(&#8220;Replace with:&#8221;)<br />
If Replace_Str = &#8220;&#8221; then App_Quit</p>
<p>Set objFSO= createobject(&#8220;Scripting.FileSystemObject&#8221;)</p>
<p>Process_Folders Folder_input</p>
<p>Sub Process_Folders(byval Folder)<br />
Dim objFolder, colSubfolders, New_Folder<br />
	Set objFolder = objFSO.GetFolder(Folder)<br />
	Set colSubfolders = objFolder.Subfolders</p>
<p>	For each objSubfolder in colSubfolders<br />
		New_Folder = (Replace(objSubfolder.name, find_str, replace_str))<br />
			If New_Folder <> objSubFolder.Name Then<br />
				objSubFolder.Name = New_Folder<br />
			End If<br />
		Process_Folders objSubfolder.path<br />
	Next</p>
<p>End Sub</p>
<p>Sub App_Quit<br />
	wscript.quit<br />
End Sub</p></blockquote>
<p>To make it even easier to run from my desktop, I created a simple batch file that fires off the script:</p>
<blockquote><p>d:<br />
cd\wutemp<br />
cscript folder_rename.vbs<br />
exit</p></blockquote>
<p>The replace method is case sensitive but otherwise it will take any combination of letters/symbols and replace them with whatever you specific for each folder name within the root folder you declare at the beginning of the script. </p>
]]></content:encoded>
			<wfw:commentRss>http://thetobers.net/2009/03/recursive-folder-renaming/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

