Renaming folders
Thank you so much -
that looks very much like what I need.
Erm... but I don't see the word "print" anywhere except in
the comment ?
i.e. where does it actually DO anything ? <grin
i.e. where do I start my "operations"
to change the foldernames (how do I do that?)
and filenames (I can do that)?
-----Original Message-----
Hi Robin, I posted this code yesterday to help somebody
run recursively through files. It sould give you a very
good idea of how to get what you want. To use it, you
first need to set a reference to the Microsoft Scripting
Runtime object (from Tools|Refernces menu option)
Public Sub GetFiles()
'prints out file type and path for each file in PATH and
any subdirectories
Const PATH As String = "C:\Mcskew"
Dim objFSo As New FileSystemObject
Dim objFolder As Folder
Dim rngOut As Range
Set rngOut = Range("A1")
Set objFolder = objFSo.GetFolder(PATH)
Process rngOut, objFolder
End Sub
Public Sub Process(ByRef p_rngOut As Range, ByRef
p_objFolder As Folder)
Dim objFolder As Folder
Dim objFile As File
For Each objFile In p_objFolder.Files
'loop through all files
p_rngOut.Value = objFile.Name
p_rngOut.Offset(0, 1).Value = objFile.PATH
p_rngOut.Offset(0, 2).Value = objFile.Type
Set p_rngOut = p_rngOut.Offset(1)
Next
For Each objFolder In p_objFolder.SubFolders
'loop through all folders in this directory
Process p_rngOut, objFolder
Next
End Sub
Rgds
Rog
-----Original Message-----
Greetings !
On the part of the Server that I have inherited,
there is a Tree consisting of
over 2,000 folders and sub-folders,
containing some 20,000 files in all.
Most of these folders have names such as
Transmittal Document379 040803 - Addendum 1 Rev01
where the 379 is the unique sequence number, and the
040803 is the date (3 Aug 2004)
What I want to do is "simply"
to run recursively through this entire batch,
deleting the words "Transmittal Document"
I would appreciate help on:
finding the sub-folder names
re-naming them
recursion in this context
finding the file names.
I DO know how to re-name THEM <grin
Thanks in anticipation
RClay AT haswell DOT com
.
.
|