Solved

vba to loop throuhg file in many folders

Posted on 2013-06-17
2
451 Views
Last Modified: 2013-06-17
Hello ,

There are 10-15 folders in a SharePoint directory.
Each folder has a just one file.
Need: >> Loop through each file of those folders and copy them to the local hard drive at C:\HH\
How to do this best? VBA Powershell ….VBA preferred.
0
Comment
Question by:Rayne
2 Comments
 
LVL 35

Accepted Solution

by:
YZlat earned 500 total points
ID: 39254204
Option Explicit
Dim strFolder, objFSO, objFolder, colSubfolders, strOutput, objFile

strFolder = "your sharepath here"

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set colSubfolders = objFSO.GetFolder(strFolder).SubFolders

For Each objFolder in colSubfolders
	For Each objFile in objFolder.Files
        	objFSO.CopyFile objFile.path, "C:\HH\"
	Next
Next

Open in new window

0
 

Author Comment

by:Rayne
ID: 39254277
Thanks YZLat, you did perfection in just few lines, AWESOME
Thank you
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Utilizing an array to gracefully append to a list of EmailAddresses
No matter the version of Windows you are using, you may have some problems with Windows Search running too slow or possibly not running at all. Before jumping into how you can solve this issue, just know there are many other viable alternative deskt…
Learn how to make your own table of contents in Microsoft Word using paragraph styles and the automatic table of contents tool. We'll be using the paragraph styles in Word’s Home toolbar to help you create a table of contents. Type out your initial …
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.

910 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now