Solved

vba to loop throuhg file in many folders

Posted on 2013-06-17
2
457 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Using Word 2013, I was experiencing some incredible lag when typing.  Here's what worked for me....
Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

820 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