Dir() retrieves filenames, not files. If you rename the file, that's a new
name, and Dir() retrieves it.
What you need to do is to collect all the filenames in the folder (eg into a
collection), then rename them all, maybe something like this --
Dim pCollection as collection
Dim pName as variant 'Has to be a variant or object to iterate a
collection
For x = 1 To 300
'Get all the names in the folder
set pCollection = new collection
strOldName = Dir(pad & "\" & x & "\*.ape")
Do While Len(strOldName) > 0
pCollection.Add strOldName
strOldName = Dir()
Loop
'Rename the files
For each pName in pCollection
strOldName = pad & "\" & x & "\" & pName
strNewName = pad & "\" & x & "\" & x & "_" & strOldName
Name strOldName As strNewName
Next
Next
> Hello,
> A question.
[quoted text clipped - 34 lines]
>
> Thanks a lot
Access101 - 05 Apr 2006 18:42 GMT
Is the filename prefix consistent enough to do this:
If mid(fname, 3, 1) = "_" then
'parse before renaming file
else
'rename file normally
end if
> Dir() retrieves filenames, not files. If you rename the file, that's a new
> name, and Dir() retrieves it.
[quoted text clipped - 63 lines]
> >
> > Thanks a lot
canvas - 06 Apr 2006 07:29 GMT
Thank you very much this works great...superb