<?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>vbscriptblog.com &#187; files</title>
	<atom:link href="http://vbscriptblog.com/tag/files/feed/" rel="self" type="application/rss+xml" />
	<link>http://vbscriptblog.com</link>
	<description>Scripting for Windows Sysadmins</description>
	<lastBuildDate>Wed, 11 Apr 2012 07:23:08 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>VBscript and WMI: VBscript to find files with specific extensions and creation date on remote servers</title>
		<link>http://vbscriptblog.com/vbscript/wmi/files-wmi/vbscript-and-wmi-vbscript-to-find-files-with-specific-extensions-and-creation-date-on-remote-servers/</link>
		<comments>http://vbscriptblog.com/vbscript/wmi/files-wmi/vbscript-and-wmi-vbscript-to-find-files-with-specific-extensions-and-creation-date-on-remote-servers/#comments</comments>
		<pubDate>Mon, 21 Mar 2011 14:27:40 +0000</pubDate>
		<dc:creator>dirk adamsky</dc:creator>
				<category><![CDATA[files]]></category>
		<category><![CDATA[command prompt]]></category>
		<category><![CDATA[cscript]]></category>
		<category><![CDATA[enumerate]]></category>
		<category><![CDATA[list]]></category>
		<category><![CDATA[vbs]]></category>
		<category><![CDATA[vbscript]]></category>
		<category><![CDATA[wmi]]></category>

		<guid isPermaLink="false">http://deludi.nl/blog/?p=993</guid>
		<description><![CDATA[I recently got the question to find all Symantec BESR snaphot files older than 2 weeks (the retention period) on the company servers. This so that we could clear up some space on the snapshot volumes. I decided to make a general purpose script of it. You can use it to find old logfiles, etc. [...]]]></description>
			<content:encoded><![CDATA[<p>I recently got the question to find all <a href="http://www.symantec.com/business/backup-exec-system-recovery-server-edition">Symantec BESR</a> snaphot files older than 2 weeks (the retention period) on the company servers. This so that we could clear up some space on the snapshot volumes.<br />
I decided to make a general purpose script of it.<br />
You can use it to find old logfiles, etc.</p>
<p>What the script does:</p>
<ul>
<li>create an array with all server you want to check (replace srv001, etc with your server names)</li>
<li>create a variable with a date of 2 weeks ago (Date -14)(can easily be changed in 30, 60 days ago)</li>
<li>change the variable date to the UTC date of 14 days ago (because WMI works with UTC dates)</li>
<li>for each server in the array</li>
<li>make a wmi connection</li>
<li>query for files with specific extensions and a creation date older than 14 days ago</li>
<li>in this example i took .txt and .csv extensions, change them in whatever filetype you want</li>
</ul>
<p>The script is tested in an win2003 environment.</p>
<p>Follow the next steps to run the script  (admin rights needed):</p>
<ul>
<li>copy and paste the script in your favorite text editor</li>
<li>replace the strings &#8216;srv001&#8242; and &#8216;srv002&#8242; with the name of your exchange server</li>
<li>replace the extensions &#8216;txt&#8217; and &#8216;csv with the extensions you need</li>
<li>save the script (for example c:tempfindoldfileswithspecificextensions.vbs)(or something shorter..)</li>
<li>open a command prompt</li>
<li>go to &#8220;c:temp&#8221;</li>
<li>give &#8220;cscript findoldfileswithspecificextensions.vbs&#8221; (without quotes) and enter</li>
</ul>
<p>When you want the output in a file please give this command:</p>
<p>&#8220;cscript findoldfileswithspecificextensions.vbs &gt; findoldfileswithspecificextensions.txt&#8221; (again without the quotes)</p>
<p>The script:</p>
<pre class="brush: vb; title: ; notranslate">
' Name : findoldfileswithspecificextensions.vbs
' Description : VBscript to find files with specific extensions and creation date on remote servers
' Author : dirk adamsky - deludi bv
' Version : 1.00
' Date : 21-03-2011
' Level: intermediate

arrServers = Array(&quot;srv001&quot;,&quot;srv002&quot;)
strDate = Date - 14
Set objDateToUtcDate = CreateObject(&quot;WbemScripting.SWbemDateTime&quot;)
objDateToUtcDate.SetVarDate(strDate)

For Each Server in arrServers
	Set objWMIService = GetObject(&quot;winmgmts:{impersonationLevel=impersonate}!\&quot; &amp; Server &amp; &quot;rootcimv2&quot;)
	Set colFiles = objWMIService.ExecQuery(&quot;Select * from CIM_DataFile where (Extension = 'txt' or Extension = 'csv') and CreationDate &lt; '&quot; &amp; objDateToUtcDate &amp; &quot;'&quot;)
	For Each objFile in colFiles
		Wscript.Echo objFile.Name
	Next
	Set colFiles = Nothing
	Set objWMIService = Nothing
Next
Set objDateToUtcDate = Nothing
</pre>
<p>When you have problems/questions please post a reply or give a &#8216;star&#8217; rating.</p>
<p>Happy scripting.</p>
<p>Best regards,</p>
<p>Dirk Adamsky &#8211; Deludi BV</p>
<div class="bottomcontainerBox" style="background-color:#F0F4F9;">
			<div style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;">
			<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fvbscriptblog.com%2Fvbscript%2Fwmi%2Ffiles-wmi%2Fvbscript-and-wmi-vbscript-to-find-files-with-specific-extensions-and-creation-date-on-remote-servers%2F&amp;layout=button_count&amp;show_faces=false&amp;width=85&amp;action=like&amp;font=verdana&amp;colorscheme=light&amp;height=21" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:85px; height:21px;"></iframe></div>
			<div style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;">
			<g:plusone size="medium" href="http://vbscriptblog.com/vbscript/wmi/files-wmi/vbscript-and-wmi-vbscript-to-find-files-with-specific-extensions-and-creation-date-on-remote-servers/"></g:plusone>
			</div>
			<div style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;">
			<a href="http://twitter.com/share" class="twitter-share-button" data-url="http://vbscriptblog.com/vbscript/wmi/files-wmi/vbscript-and-wmi-vbscript-to-find-files-with-specific-extensions-and-creation-date-on-remote-servers/"  data-text="VBscript and WMI: VBscript to find files with specific extensions and creation date on remote servers" data-count="horizontal" data-via="dirkadamsky"></a>
			</div>			
			<div style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"><script src="http://www.stumbleupon.com/hostedbadge.php?s=1&amp;r=http://vbscriptblog.com/vbscript/wmi/files-wmi/vbscript-and-wmi-vbscript-to-find-files-with-specific-extensions-and-creation-date-on-remote-servers/"></script></div>			
			</div><div style="clear:both"></div><div style="padding-bottom:4px;"></div>]]></content:encoded>
			<wfw:commentRss>http://vbscriptblog.com/vbscript/wmi/files-wmi/vbscript-and-wmi-vbscript-to-find-files-with-specific-extensions-and-creation-date-on-remote-servers/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Active Directory: VBscript to enumerate the roaming profile size of all users in Active Directory</title>
		<link>http://vbscriptblog.com/vbscript/active-directory/roamingprofile/active-directory-vbscript-to-enumerate-the-roaming-profile-size-of-all-users-in-active-directory/</link>
		<comments>http://vbscriptblog.com/vbscript/active-directory/roamingprofile/active-directory-vbscript-to-enumerate-the-roaming-profile-size-of-all-users-in-active-directory/#comments</comments>
		<pubDate>Mon, 15 Mar 2010 10:14:19 +0000</pubDate>
		<dc:creator>dirk adamsky</dc:creator>
				<category><![CDATA[roamingprofile]]></category>
		<category><![CDATA[active directory]]></category>
		<category><![CDATA[attribute]]></category>
		<category><![CDATA[command prompt]]></category>
		<category><![CDATA[cscript]]></category>
		<category><![CDATA[email]]></category>
		<category><![CDATA[enumerate]]></category>
		<category><![CDATA[files]]></category>
		<category><![CDATA[filesystem object]]></category>
		<category><![CDATA[folder]]></category>
		<category><![CDATA[list]]></category>
		<category><![CDATA[mail]]></category>
		<category><![CDATA[number]]></category>
		<category><![CDATA[profilePath]]></category>
		<category><![CDATA[roaming profile]]></category>
		<category><![CDATA[smtp address]]></category>
		<category><![CDATA[status]]></category>
		<category><![CDATA[user]]></category>
		<category><![CDATA[vbscript]]></category>

		<guid isPermaLink="false">http://deludi.nl/blog/?p=427</guid>
		<description><![CDATA[For a sysadmin roaming profiles are both a blessing and a curse. In time they tend to grow and grow&#8230; The roaming profile size problem results in: long logon and logoff times, corrupted profiles, etc. This script enumerates the roaming profile size of all users in your Active Directory domain. By adding extra attributes to [...]]]></description>
			<content:encoded><![CDATA[<p>For a sysadmin roaming profiles are both a blessing and a curse.<br />
In time they tend to grow and grow&#8230;<br />
The roaming profile size problem results in: long logon and logoff times, corrupted profiles, etc.<br />
This script enumerates the roaming profile size of all users in your Active Directory domain.<br />
By adding extra attributes to the arrAttributes array you can change the output. </p>
<p>Follow the next steps to run the script (admin rights needed for access to the roaming profiles directory):</p>
<p>* open your favorite text editor<br />
* copy and paste the script into the editor<br />
* save the script (for example c:\temp\roamingprofilesize.vbs)<br />
* open a command prompt<br />
* go to &#8220;c:\temp&#8221;<br />
* give &#8220;cscript roamingprofilesize.vbs&#8221; (without quotes) and enter</p>
<p>The script:</p>
<pre class="brush: vb; title: ; notranslate">
' Name : roamingprofilesize.vbs
' Description : script to enumerate the roaming profile size of all users in Active Directory
' Author : dirk adamsky - deludi bv
' Version : 1.10 (changed script error based on input from Jim)
' Date : 06-05-2011
' Level : intermediate

arrAttributes = Array(&quot;profilePath&quot;,&quot;displayname&quot;,&quot;mail&quot;) 

Set adoCommand = CreateObject(&quot;ADODB.Command&quot;)
Set adoConnection = CreateObject(&quot;ADODB.Connection&quot;)
adoConnection.Provider = &quot;ADsDSOObject&quot;
adoConnection.Open &quot;Active Directory Provider&quot;
adoCommand.ActiveConnection = adoConnection

Set objRootDSE = GetObject(&quot;LDAP://RootDSE&quot;)
strBase = &quot;&lt;LDAP://&quot; &amp; objRootDSE.Get(&quot;defaultNamingContext&quot;) &amp; &quot;&gt;&quot;
Set objRootDSE = Nothing

strFilter = &quot;(&amp;(objectCategory=person)(objectClass=user)(profilePath=*))&quot;
strAttributes = Join(arrAttributes,&quot;,&quot;)
Wscript.Echo Join(arrAttributes,&quot;;&quot;) &amp; &quot; ; roaming profile size in MB&quot;
strQuery = strBase &amp; &quot;;&quot; &amp; strFilter &amp; &quot;;&quot; &amp; strAttributes &amp; &quot;;subtree&quot;
adoCommand.CommandText = strQuery
adoCommand.Properties(&quot;Page Size&quot;) = 100
adoCommand.Properties(&quot;Timeout&quot;) = 30
adoCommand.Properties(&quot;Cache Results&quot;) = False
Set adoRecordset = adoCommand.Execute
Do Until adoRecordset.EOF
	On Error Resume Next
	strTempOutput = &quot;&quot;
	For i = 0 To Ubound(arrAttributes)
		strTempOutput =  strTempOutput &amp; &quot; ; &quot; &amp; adoRecordset.Fields(arrAttributes(i)).Value
		strOutput = Mid(Ltrim(strTempOutput),3)
	Next
	Wscript.Echo strOutput &amp; &quot; ; &quot; &amp; Foldersize (adoRecordset.Fields(arrAttributes(0)).Value) &amp; &quot; MB&quot;
	adoRecordset.MoveNext
Loop
adoRecordset.Close
adoConnection.Close
Set adoRecordset = Nothing
Set adoConnection = Nothing
Set adoCommand = Nothing

Function Foldersize(strPath)
	On Error Resume Next
	Set objFSO = CreateObject(&quot;scripting.filesystemobject&quot;)
	Set objFld = objFSO.GetFolder(strPath)
	Foldersize = Round(objFld.Size/1048576,2)
	Set objFld = Nothing
	Set objFSO = Nothing
End Function
</pre>
<p>When you have problems/questions please post a reply. Also can alo give a &#8216;star&#8217; rating. </p>
<p>Happy scripting.</p>
<p>Best regards,</p>
<p>Dirk Adamsky &#8211; Deludi BV</p>
<div class="bottomcontainerBox" style="background-color:#F0F4F9;">
			<div style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;">
			<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fvbscriptblog.com%2Fvbscript%2Factive-directory%2Froamingprofile%2Factive-directory-vbscript-to-enumerate-the-roaming-profile-size-of-all-users-in-active-directory%2F&amp;layout=button_count&amp;show_faces=false&amp;width=85&amp;action=like&amp;font=verdana&amp;colorscheme=light&amp;height=21" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:85px; height:21px;"></iframe></div>
			<div style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;">
			<g:plusone size="medium" href="http://vbscriptblog.com/vbscript/active-directory/roamingprofile/active-directory-vbscript-to-enumerate-the-roaming-profile-size-of-all-users-in-active-directory/"></g:plusone>
			</div>
			<div style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;">
			<a href="http://twitter.com/share" class="twitter-share-button" data-url="http://vbscriptblog.com/vbscript/active-directory/roamingprofile/active-directory-vbscript-to-enumerate-the-roaming-profile-size-of-all-users-in-active-directory/"  data-text="Active Directory: VBscript to enumerate the roaming profile size of all users in Active Directory" data-count="horizontal" data-via="dirkadamsky"></a>
			</div>			
			<div style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"><script src="http://www.stumbleupon.com/hostedbadge.php?s=1&amp;r=http://vbscriptblog.com/vbscript/active-directory/roamingprofile/active-directory-vbscript-to-enumerate-the-roaming-profile-size-of-all-users-in-active-directory/"></script></div>			
			</div><div style="clear:both"></div><div style="padding-bottom:4px;"></div>]]></content:encoded>
			<wfw:commentRss>http://vbscriptblog.com/vbscript/active-directory/roamingprofile/active-directory-vbscript-to-enumerate-the-roaming-profile-size-of-all-users-in-active-directory/feed/</wfw:commentRss>
		<slash:comments>28</slash:comments>
		</item>
		<item>
		<title>Filesystem: VBscript to enumerate the subfolders (recursive) with depth limit</title>
		<link>http://vbscriptblog.com/vbscript/filesystem/folders/filesystem-vbscript-to-enumerate-the-subfolders-recursive-with-depth-limit/</link>
		<comments>http://vbscriptblog.com/vbscript/filesystem/folders/filesystem-vbscript-to-enumerate-the-subfolders-recursive-with-depth-limit/#comments</comments>
		<pubDate>Fri, 05 Mar 2010 10:28:59 +0000</pubDate>
		<dc:creator>dirk adamsky</dc:creator>
				<category><![CDATA[folders]]></category>
		<category><![CDATA[attribute]]></category>
		<category><![CDATA[command prompt]]></category>
		<category><![CDATA[computer]]></category>
		<category><![CDATA[cscript]]></category>
		<category><![CDATA[depth]]></category>
		<category><![CDATA[enumerate]]></category>
		<category><![CDATA[files]]></category>
		<category><![CDATA[filesystem object]]></category>
		<category><![CDATA[limit]]></category>
		<category><![CDATA[list]]></category>
		<category><![CDATA[objFSO]]></category>
		<category><![CDATA[recursion]]></category>
		<category><![CDATA[subfolders]]></category>
		<category><![CDATA[unc]]></category>
		<category><![CDATA[vb]]></category>
		<category><![CDATA[vbs]]></category>
		<category><![CDATA[vbscript]]></category>

		<guid isPermaLink="false">http://deludi.nl/blog/?p=404</guid>
		<description><![CDATA[Here&#8217;s the second script of today. It is a mutation of the previous script. Added is a depth limit, this is done by a second argument of the subroutine. The subroutine needs two arguments: the path of the folder and the depth level. The path can be local (&#8220;c:temp&#8221;) or an UNC path like &#8220;\servertest&#8221;. [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s the second script of today.<br />
It is a mutation of the previous <a href="http://deludi.nl/blog/vbscript/filesystem/folders/filesystem-vbscript-to-enumerate-all-subfolders-recursive-of-a-given-folder/">script</a>.<br />
Added is a depth limit, this is done by a second argument of the subroutine.<br />
The subroutine needs two arguments: the path of the folder and the depth level.<br />
The path can be local (&#8220;c:temp&#8221;) or an UNC path like &#8220;\servertest&#8221;.</p>
<p>Follow the next steps to run the script  (admin rights needed on the folder you want to enumerate):</p>
<ul>
<li>open your favorite text editor</li>
<li>copy and paste the script into the editor</li>
<li>change the path of the folder to your folder path</li>
<li>change the depth value to your depth value (current value = 2)</li>
<li>save the script (for example c:tempenumeratesubfolderslevel.vbs)</li>
<li>open a command prompt</li>
<li>go to &#8220;c:temp&#8221;</li>
<li>give &#8220;cscript enumeratesubfolderslevel.vbs&#8221; (without quotes) and enter</li>
</ul>
<p>The script:</p>
<pre class="brush: vb; title: ; notranslate">
' Name : enumeratesubfolderslevel.vbs
' Description : script to enumerate the subfolders (recursive) with depth limit
' Author : dirk adamsky - deludi bv
' Version : 1.01 corrected small counter error
' Date : 05-03-2010
' Level : Intermediate

ViewSubFolders &quot;c:temp&quot;, 2
Sub ViewSubFolders(strFolder, strMaxLevel)
	Set objFSO = CreateObject(&quot;Scripting.FileSystemObject&quot;)
	Set objFolder = objFSO.GetFolder(strFolder)
	If strMaxlevel &gt;= 1 Then
		For Each SubFolder in objFolder.SubFolders
			Wscript.Echo SubFolder.Path
			ViewSubFolders SubFolder, (strMaxlevel - 1)
		Next
	End If
	Set objFolder = Nothing
	Set objFSO = Nothing
End Sub
</pre>
<p>When you have problems/questions please make a reply, when you like the script please rate it with the star rating below.</p>
<p>Happy scripting.</p>
<p>Best regards,</p>
<p>Dirk Adamsky &#8211; Deludi BV</p>
<p>[adrotate group="2" banner="3"] </p>
<div class="bottomcontainerBox" style="background-color:#F0F4F9;">
			<div style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;">
			<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fvbscriptblog.com%2Fvbscript%2Ffilesystem%2Ffolders%2Ffilesystem-vbscript-to-enumerate-the-subfolders-recursive-with-depth-limit%2F&amp;layout=button_count&amp;show_faces=false&amp;width=85&amp;action=like&amp;font=verdana&amp;colorscheme=light&amp;height=21" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:85px; height:21px;"></iframe></div>
			<div style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;">
			<g:plusone size="medium" href="http://vbscriptblog.com/vbscript/filesystem/folders/filesystem-vbscript-to-enumerate-the-subfolders-recursive-with-depth-limit/"></g:plusone>
			</div>
			<div style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;">
			<a href="http://twitter.com/share" class="twitter-share-button" data-url="http://vbscriptblog.com/vbscript/filesystem/folders/filesystem-vbscript-to-enumerate-the-subfolders-recursive-with-depth-limit/"  data-text="Filesystem: VBscript to enumerate the subfolders (recursive) with depth limit" data-count="horizontal" data-via="dirkadamsky"></a>
			</div>			
			<div style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"><script src="http://www.stumbleupon.com/hostedbadge.php?s=1&amp;r=http://vbscriptblog.com/vbscript/filesystem/folders/filesystem-vbscript-to-enumerate-the-subfolders-recursive-with-depth-limit/"></script></div>			
			</div><div style="clear:both"></div><div style="padding-bottom:4px;"></div>]]></content:encoded>
			<wfw:commentRss>http://vbscriptblog.com/vbscript/filesystem/folders/filesystem-vbscript-to-enumerate-the-subfolders-recursive-with-depth-limit/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Filesystem: VBscript to enumerate all subfolders (recursive) of a given folder</title>
		<link>http://vbscriptblog.com/vbscript/filesystem/folders/filesystem-vbscript-to-enumerate-all-subfolders-recursive-of-a-given-folder/</link>
		<comments>http://vbscriptblog.com/vbscript/filesystem/folders/filesystem-vbscript-to-enumerate-all-subfolders-recursive-of-a-given-folder/#comments</comments>
		<pubDate>Fri, 05 Mar 2010 08:10:57 +0000</pubDate>
		<dc:creator>dirk adamsky</dc:creator>
				<category><![CDATA[folders]]></category>
		<category><![CDATA[command prompt]]></category>
		<category><![CDATA[computer]]></category>
		<category><![CDATA[cscript]]></category>
		<category><![CDATA[enumerate]]></category>
		<category><![CDATA[files]]></category>
		<category><![CDATA[filesystem object]]></category>
		<category><![CDATA[folder]]></category>
		<category><![CDATA[list]]></category>
		<category><![CDATA[number]]></category>
		<category><![CDATA[recursion]]></category>
		<category><![CDATA[subfolders]]></category>
		<category><![CDATA[vbs]]></category>
		<category><![CDATA[vbscript]]></category>

		<guid isPermaLink="false">http://deludi.nl/blog/?p=395</guid>
		<description><![CDATA[The motto of the day is: Recursion rules. A couple of years ago I have done quite a few Filesystem Object scripts. To refresh my mind I have made some new filesystem scripts. This is the first one: a simple subroutine that uses recursion to enumrate all subfolders of a folder. The subroutine needs one [...]]]></description>
			<content:encoded><![CDATA[<p>The motto of the day is: Recursion rules.<br />
A couple of years ago I have done quite a few Filesystem Object scripts.<br />
To refresh my mind I have made some new filesystem scripts.<br />
This is the first one: a simple subroutine that uses recursion to enumrate all subfolders of a folder.<br />
The subroutine needs one argument: the path of the folder.<br />
The path can be local (&#8220;c:temp&#8221;) or an UNC path like &#8220;\servertest&#8221;.</p>
<p>Follow the next steps to run the script  (admin rights needed on the folder you want to enumerate):</p>
<ul>
<li>open your favorite text editor</li>
<li>copy and paste the script into the editor</li>
<li>change the path of the folder to your folder path</li>
<li>save the script (for example c:tempenumeratesubfolders.vbs)</li>
<li>open a command prompt</li>
<li>go to &#8220;c:temp&#8221;</li>
<li>give &#8220;cscript enumeratesubfolders.vbs&#8221; (without quotes) and enter</li>
</ul>
<p>The script:</p>
<pre class="brush: vb; title: ; notranslate">
' Name : enumeratesubfolders.vbs
' Description : script to enumerate all subfolders (recursive) of a given folder
' Author : dirk adamsky - deludi bv
' Version : 1.00
' Date : 05-03-2010
' Level : Intermediate

ViewSubFolders &quot;c:temp&quot;
Sub ViewSubFolders(strFolder)
	Set objFSO = CreateObject(&quot;Scripting.FileSystemObject&quot;)
	Set objFolder = objFSO.GetFolder(strFolder)
	For Each SubFolder in objFolder.SubFolders
		Wscript.Echo SubFolder.Path
		ViewSubFolders SubFolder
	Next
	Set objFolder = Nothing
	Set objFSO = Nothing
End Sub
</pre>
<p>When you have problems/questions please make a reply, when you like the script please rate it with the star rating below.</p>
<p>Happy scripting.</p>
<p>Best regards,</p>
<p>Dirk Adamsky &#8211; Deludi BV</p>
<p>[adrotate group="3"] </p>
<div class="bottomcontainerBox" style="background-color:#F0F4F9;">
			<div style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;">
			<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fvbscriptblog.com%2Fvbscript%2Ffilesystem%2Ffolders%2Ffilesystem-vbscript-to-enumerate-all-subfolders-recursive-of-a-given-folder%2F&amp;layout=button_count&amp;show_faces=false&amp;width=85&amp;action=like&amp;font=verdana&amp;colorscheme=light&amp;height=21" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:85px; height:21px;"></iframe></div>
			<div style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;">
			<g:plusone size="medium" href="http://vbscriptblog.com/vbscript/filesystem/folders/filesystem-vbscript-to-enumerate-all-subfolders-recursive-of-a-given-folder/"></g:plusone>
			</div>
			<div style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;">
			<a href="http://twitter.com/share" class="twitter-share-button" data-url="http://vbscriptblog.com/vbscript/filesystem/folders/filesystem-vbscript-to-enumerate-all-subfolders-recursive-of-a-given-folder/"  data-text="Filesystem: VBscript to enumerate all subfolders (recursive) of a given folder" data-count="horizontal" data-via="dirkadamsky"></a>
			</div>			
			<div style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"><script src="http://www.stumbleupon.com/hostedbadge.php?s=1&amp;r=http://vbscriptblog.com/vbscript/filesystem/folders/filesystem-vbscript-to-enumerate-all-subfolders-recursive-of-a-given-folder/"></script></div>			
			</div><div style="clear:both"></div><div style="padding-bottom:4px;"></div>]]></content:encoded>
			<wfw:commentRss>http://vbscriptblog.com/vbscript/filesystem/folders/filesystem-vbscript-to-enumerate-all-subfolders-recursive-of-a-given-folder/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Files: Powershell command to copy a file to another directory</title>
		<link>http://vbscriptblog.com/powershell/files-powershell-command-to-copy-a-file-to-another-directory/</link>
		<comments>http://vbscriptblog.com/powershell/files-powershell-command-to-copy-a-file-to-another-directory/#comments</comments>
		<pubDate>Thu, 18 Feb 2010 14:02:05 +0000</pubDate>
		<dc:creator>dirk adamsky</dc:creator>
				<category><![CDATA[file]]></category>
		<category><![CDATA[powershell]]></category>
		<category><![CDATA[copy]]></category>
		<category><![CDATA[copy-item]]></category>
		<category><![CDATA[directory]]></category>
		<category><![CDATA[files]]></category>

		<guid isPermaLink="false">http://deludi.nl/blog/?p=310</guid>
		<description><![CDATA[Okido, here&#8217;s my first powershell script (or command line). The action I want to accomplish is to copy a file to another directory. I installed powershell v2 on my machine. To open the powershell prompt you can do next steps: give &#8216;windows key + r&#8217; (opens &#8216;Start=&#62;Run&#8217;) give &#8216;powershell&#8217; without the quotes the powershell prompt [...]]]></description>
			<content:encoded><![CDATA[<p>Okido, here&#8217;s my first powershell script (or command line).</p>
<p>The action I want to accomplish is to copy a file to another directory.<br />
I installed powershell v2 on my machine.<br />
<a href="http://deludi.nl/blog/wp-content/uploads/2010/02/powershellstart.png"><img class="alignright size-medium wp-image-311" title="powershellstart" src="http://deludi.nl/blog/wp-content/uploads/2010/02/powershellstart-300x90.png" alt="" width="300" height="90" /></a><br />
To open the powershell prompt you can do next steps:</p>
<ul>
<li>give &#8216;windows key + r&#8217; (opens &#8216;Start=&gt;Run&#8217;)</li>
<li>give &#8216;powershell&#8217; without the quotes</li>
<li>the powershell prompt now opens</li>
</ul>
<p>When you want to change the working directory give cd followed by the full path, for example &#8216;cd c:temp&#8217; (without quotes).<br />
<a href="http://deludi.nl/blog/wp-content/uploads/2010/02/powershellchangeworkingdiractioncompleted.png"><img class="alignright size-medium wp-image-318" title="powershellchangeworkingdiractioncompleted" src="http://deludi.nl/blog/wp-content/uploads/2010/02/powershellchangeworkingdiractioncompleted-300x79.png" alt="" width="300" height="79" /></a><br />
After changing the working directory it is time for action.<br />
In &#8216;c:temp&#8217; I created a file named &#8216;test.txt&#8217; and a directory called &#8216;c:temptest&#8217;.<br />
The powershell command to copy &#8216;test.txt&#8217; to the &#8216;test&#8217; directory is:</p>
<p><a href="http://deludi.nl/blog/wp-content/uploads/2010/02/copyfile.png"><img class="alignright size-medium wp-image-319" title="copyfile" src="http://deludi.nl/blog/wp-content/uploads/2010/02/copyfile-300x87.png" alt="" width="300" height="87" /></a><br />
copy-item c:temptest.txt c:temptest</p>
<p>The result is that the file test.txt is copied to c:temptesttest.txt.<br />
Instead of using copy-item you can also use the aliases &#8216;cp&#8217; or &#8216;cpi&#8217;.</p>
<p>Happy scripting.</p>
<p>Best regards,</p>
<p>Dirk Adamsky &#8211; Deludi BV</p>
<div class="bottomcontainerBox" style="background-color:#F0F4F9;">
			<div style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;">
			<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fvbscriptblog.com%2Fpowershell%2Ffiles-powershell-command-to-copy-a-file-to-another-directory%2F&amp;layout=button_count&amp;show_faces=false&amp;width=85&amp;action=like&amp;font=verdana&amp;colorscheme=light&amp;height=21" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:85px; height:21px;"></iframe></div>
			<div style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;">
			<g:plusone size="medium" href="http://vbscriptblog.com/powershell/files-powershell-command-to-copy-a-file-to-another-directory/"></g:plusone>
			</div>
			<div style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;">
			<a href="http://twitter.com/share" class="twitter-share-button" data-url="http://vbscriptblog.com/powershell/files-powershell-command-to-copy-a-file-to-another-directory/"  data-text="Files: Powershell command to copy a file to another directory" data-count="horizontal" data-via="dirkadamsky"></a>
			</div>			
			<div style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"><script src="http://www.stumbleupon.com/hostedbadge.php?s=1&amp;r=http://vbscriptblog.com/powershell/files-powershell-command-to-copy-a-file-to-another-directory/"></script></div>			
			</div><div style="clear:both"></div><div style="padding-bottom:4px;"></div>]]></content:encoded>
			<wfw:commentRss>http://vbscriptblog.com/powershell/files-powershell-command-to-copy-a-file-to-another-directory/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Active Directory: VBscript to count the number of files on homedirectory for groupmembers</title>
		<link>http://vbscriptblog.com/vbscript/active-directory/files/active-directory-vbscript-to-count-the-number-of-files-on-homedirectory-for-groupmembers/</link>
		<comments>http://vbscriptblog.com/vbscript/active-directory/files/active-directory-vbscript-to-count-the-number-of-files-on-homedirectory-for-groupmembers/#comments</comments>
		<pubDate>Tue, 26 Jan 2010 12:33:40 +0000</pubDate>
		<dc:creator>dirk adamsky</dc:creator>
				<category><![CDATA[files]]></category>
		<category><![CDATA[homedirectory]]></category>
		<category><![CDATA[homeshare]]></category>
		<category><![CDATA[number]]></category>
		<category><![CDATA[vbs]]></category>
		<category><![CDATA[vbscript]]></category>

		<guid isPermaLink="false">http://deludi.nl/blog/?p=113</guid>
		<description><![CDATA[This script is for reporting purposes. It enumerates the members of a specified group and calculates the number of files that each user has on his/her homedirectory. It is especially useful when run from the scheduler. Follow the next steps to run the script (no admin rights needed): open your favorite text editor copy and [...]]]></description>
			<content:encoded><![CDATA[<p>This script is for reporting purposes.<br />
It enumerates the members of a specified group and calculates the number of files that each user has on his/her homedirectory. It is especially useful when run from the scheduler.</p>
<p>Follow the next steps to run the script  (no admin rights needed):</p>
<ul>
<li>open your favorite text editor</li>
<li>copy and paste the script into the editor</li>
<li>change the distinguished name of the group to your specific situation</li>
<li>save the script (for example c:tempgroupfilesonhomedirectory.vbs)</li>
<li>open a command prompt</li>
<li>go to &#8220;c:temp&#8221;</li>
<li>give &#8220;cscript groupfilesonhomedirectory.vbs&#8221; (without quotes) and enter</li>
</ul>
<p>The script:</p>
<pre class="brush: vb; title: ; notranslate">
' Name : groupfilesonhomedirectory.vbs
' Description : script to count the number of files on homedirectory for groupmembers
' Author : dirk adamsky - deludi bv
' Version : 1.00
' Date : 26-01-2010

Set objGroup = GetObject(&quot;LDAP://CN=test,OU=test,DC=test,DC=org&quot;)
For Each M in objGroup.Members
	If M.homeDirectory &lt;&gt; &quot;&quot; Then
		FileCnt = 0
		ReturnFileCountUsingFSO M.homeDirectory, FileCnt
		WScript.echo M.cn &amp; &quot; ; &quot; &amp; M.homeDirectory &amp; &quot; ; &quot; &amp; FileCnt &amp; &quot; files on home directory&quot;
	End If
Next
Set objGroup = Nothing

Function ReturnFileCountUsingFSO(strPath, FileCnt)
	On Error Resume Next
	Set FSO = CreateObject(&quot;scripting.filesystemobject&quot;)
	Set fld = FSO.GetFolder(strPath)
	FileCnt = FileCnt + fld.Files.Count
	For Each f In fld.SubFolders
		ReturnFileCountUsingFSO f.path, FileCnt
	Next
	Set f = Nothing
	Set fld = Nothing
	Set FSO = Nothing
End Function
</pre>
<div class="bottomcontainerBox" style="background-color:#F0F4F9;">
			<div style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;">
			<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fvbscriptblog.com%2Fvbscript%2Factive-directory%2Ffiles%2Factive-directory-vbscript-to-count-the-number-of-files-on-homedirectory-for-groupmembers%2F&amp;layout=button_count&amp;show_faces=false&amp;width=85&amp;action=like&amp;font=verdana&amp;colorscheme=light&amp;height=21" scrolling="no" frameborder="0" allowTransparency="true" style="border:none; overflow:hidden; width:85px; height:21px;"></iframe></div>
			<div style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;">
			<g:plusone size="medium" href="http://vbscriptblog.com/vbscript/active-directory/files/active-directory-vbscript-to-count-the-number-of-files-on-homedirectory-for-groupmembers/"></g:plusone>
			</div>
			<div style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;">
			<a href="http://twitter.com/share" class="twitter-share-button" data-url="http://vbscriptblog.com/vbscript/active-directory/files/active-directory-vbscript-to-count-the-number-of-files-on-homedirectory-for-groupmembers/"  data-text="Active Directory: VBscript to count the number of files on homedirectory for groupmembers" data-count="horizontal" data-via="dirkadamsky"></a>
			</div>			
			<div style="float:left; width:85px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;"><script src="http://www.stumbleupon.com/hostedbadge.php?s=1&amp;r=http://vbscriptblog.com/vbscript/active-directory/files/active-directory-vbscript-to-count-the-number-of-files-on-homedirectory-for-groupmembers/"></script></div>			
			</div><div style="clear:both"></div><div style="padding-bottom:4px;"></div>]]></content:encoded>
			<wfw:commentRss>http://vbscriptblog.com/vbscript/active-directory/files/active-directory-vbscript-to-count-the-number-of-files-on-homedirectory-for-groupmembers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

