Solved

vba to loop throuhg file in many folders

Posted on 2013-06-17
2
459 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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
Outlook Free & Paid Tools
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.

732 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