<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.technet.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>How Can I List the Files in a Folder and All Its Subfolders?</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2005/02/18/how-can-i-list-the-files-in-a-folder-and-all-its-subfolders.aspx</link><description>Hey, Scripting Guy! How can I list all of the files in a folder, as well as all the files in any subfolders of that folder? -- MA 
 Hey, MA. This is a question we get asked quite a bit, and one which have avoided answering up till now. That’s because</description><dc:language>en-US</dc:language><generator>Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><item><title>re: How Can I List the Files in a Folder and All Its Subfolders?</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2005/02/18/how-can-i-list-the-files-in-a-folder-and-all-its-subfolders.aspx#3570562</link><pubDate>Fri, 03 May 2013 11:10:33 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3570562</guid><dc:creator>palclan</dc:creator><description>&lt;p&gt;And while I am shamelessly stealing code, please update with code below to avoid problems with directories using quote(s) in their name (stolen from David Brown on Google mailing list):&lt;/p&gt;
&lt;p&gt;--&lt;/p&gt;
&lt;p&gt;Rather than using the single-quote (&amp;#39;) as a delimiter, you can use the double-quote&lt;/p&gt;
&lt;p&gt;(&amp;quot;) if you escape it. &amp;nbsp;In VBS you escape a character by doubling it, so &amp;quot;&amp;quot;&lt;/p&gt;
&lt;p&gt;. &amp;nbsp;For some reason, this seems to work better in this situation.&lt;/p&gt;
&lt;p&gt;Using the following revision, I was able to get folders with &amp;#39; or } in them,&lt;/p&gt;
&lt;p&gt;but I had to escape the backslashes ( \\ )&lt;/p&gt;
&lt;p&gt;strFolderName = &amp;quot;c:\\quote_test\\b{o&amp;#39;t}h&amp;quot;&lt;/p&gt;
&lt;p&gt;&amp;quot;Associators of {Win32_Directory.Name=&amp;quot;&amp;quot;&amp;quot; &amp;amp; strFolderName &amp;amp; &amp;quot;&amp;quot;&amp;quot;} &amp;quot; _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;amp; &amp;quot;Where AssocClass = Win32_Subdirectory &amp;quot; _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;amp; &amp;quot;ResultRole = PartComponent&amp;quot;&lt;/p&gt;
&lt;p&gt;--&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3570562" width="1" height="1"&gt;</description></item><item><title>re: How Can I List the Files in a Folder and All Its Subfolders?</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2005/02/18/how-can-i-list-the-files-in-a-folder-and-all-its-subfolders.aspx#3570561</link><pubDate>Fri, 03 May 2013 11:03:30 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3570561</guid><dc:creator>palclan</dc:creator><description>&lt;p&gt;Am I the only one finding this part of code funny (and useless) ?&lt;/p&gt;
&lt;p&gt;--&lt;/p&gt;
&lt;p&gt;For Each objFolder in colSubfolders&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;GetSubFolders strFolderName&lt;/p&gt;
&lt;p&gt;Next&lt;/p&gt;
&lt;p&gt;--&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3570561" width="1" height="1"&gt;</description></item><item><title>re: How Can I List the Files in a Folder and All Its Subfolders?</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2005/02/18/how-can-i-list-the-files-in-a-folder-and-all-its-subfolders.aspx#3555073</link><pubDate>Tue, 26 Feb 2013 18:11:31 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3555073</guid><dc:creator>Ladders</dc:creator><description>&lt;p&gt;This is great and almost what I&amp;#39;m looking for but ideally I want to create an XML file that has all of the file names in it rather than having them pop up on the screen... any idea on whether this is possible please and how to acheive it? Thanks&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3555073" width="1" height="1"&gt;</description></item><item><title>re: How Can I List the Files in a Folder and All Its Subfolders?</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2005/02/18/how-can-i-list-the-files-in-a-folder-and-all-its-subfolders.aspx#3544864</link><pubDate>Wed, 09 Jan 2013 09:34:09 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3544864</guid><dc:creator>The Answer</dc:creator><description>&lt;p&gt;If all the files are the same format, &amp;nbsp;click on the base folder you want to list, and type the format into the search bar.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3544864" width="1" height="1"&gt;</description></item><item><title>re: How Can I List the Files in a Folder and All Its Subfolders?</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2005/02/18/how-can-i-list-the-files-in-a-folder-and-all-its-subfolders.aspx#3427492</link><pubDate>Mon, 09 May 2011 06:10:52 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3427492</guid><dc:creator>Chmmr</dc:creator><description>&lt;p&gt;If you just need this as a listing you could use it via batch script.&lt;/p&gt;
&lt;p&gt;1. Open Command Prompt (cmd)&lt;/p&gt;
&lt;p&gt;2. go to the folder &lt;/p&gt;
&lt;p&gt; &amp;nbsp; (example C:\Files you would type &lt;/p&gt;
&lt;p&gt;C:&lt;/p&gt;
&lt;p&gt;CD \&lt;/p&gt;
&lt;p&gt;CD Files&lt;/p&gt;
&lt;p&gt;3. Type (without quotation marks) &amp;quot;echo tree /F &amp;gt; listing.txt&amp;quot;&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3427492" width="1" height="1"&gt;</description></item><item><title>re: How Can I List the Files in a Folder and All Its Subfolders?</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2005/02/18/how-can-i-list-the-files-in-a-folder-and-all-its-subfolders.aspx#3342460</link><pubDate>Wed, 07 Jul 2010 10:43:32 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3342460</guid><dc:creator>Stefan</dc:creator><description>&lt;p&gt;I get a error with that script if I have a html file with a attached folder. This kind of folder which gets auto created if you save a Visio as Web page and the folder gets also deleted auto if you remove the html file. Was trying to fix that, but without success....&lt;/p&gt;
&lt;p&gt;Error comes up with 0x80041017 on line 6 from the end.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3342460" width="1" height="1"&gt;</description></item><item><title>re: How Can I List the Files in a Folder and All Its Subfolders?</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2005/02/18/how-can-i-list-the-files-in-a-folder-and-all-its-subfolders.aspx#3334467</link><pubDate>Fri, 28 May 2010 14:40:14 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3334467</guid><dc:creator>Ed</dc:creator><description>&lt;p&gt;This program crashes when it reaches a folder that looks like &lt;/p&gt;
&lt;p&gt;C:\Program Files\Adobe\Reader 9.0\Setup Files\{AC76BA86-7AD7-1033-7B44-A93xxxxxxxxx}&lt;/p&gt;
&lt;p&gt;Can anyone provide a solution please&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3334467" width="1" height="1"&gt;</description></item><item><title>re: How Can I List the Files in a Folder and All Its Subfolders?</title><link>http://blogs.technet.com/b/heyscriptingguy/archive/2005/02/18/how-can-i-list-the-files-in-a-folder-and-all-its-subfolders.aspx#3330394</link><pubDate>Wed, 05 May 2010 12:57:42 GMT</pubDate><guid isPermaLink="false">d5e57398-b9ef-4490-9955-07cbb4e4a80d:3330394</guid><dc:creator>Daz_1234</dc:creator><description>&lt;p&gt;&amp;quot;...and one which have avoided answering up till now.&amp;quot;&lt;/p&gt;
&lt;p&gt;Me thinks not ;o)&lt;/p&gt;
&lt;p&gt;See FileSystemObject version here:&lt;/p&gt;
&lt;p&gt;&lt;a rel="nofollow" target="_new" href="http://blogs.technet.com/heyscriptingguy/archive/2004/10/20/how-can-i-get-a-list-of-all-the-files-in-a-folder-and-its-subfolders.aspx"&gt;http://blogs.technet.com/heyscriptingguy/archive/2004/10/20/how-can-i-get-a-list-of-all-the-files-in-a-folder-and-its-subfolders.aspx&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Daz.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.technet.com/aggbug.aspx?PostID=3330394" width="1" height="1"&gt;</description></item></channel></rss>