View Single Post
  #4  
Old June 3rd, 2004, 05:52 PM
Eric Blitzer
external usenet poster
 
Posts: n/a
Default Rename all files in directory with oldname plus date

Thanks Wayne but I am getting a syntax error on the first line

strFileName = Dir "c:\newfiles\*.*"

Do I have this right

Thanks again
Eric


-----Original Message-----
Successive calls to Dir without any parameters will

continue to call the
next file meeting the original parameter. Do this until

Dir returns "".

strFileName = Dir "path\*.*"
Do Until strFileName = ""
Name "path\" & strFileName As "path\" &

strFileName & Format(Date,
"yyymmdd")
strFileName = Dir
Loop

Replace path with the actual path to the folder.

--
Wayne Morgan
Microsoft Access MVP


"Eric Blitzer" wrote

in message
...
I have a specified directory where I want to rename the
files with the old name plus the date. I want to do this
with one click of a command button on a form. The number
of files changes anywhere from 1 to 100. Does anyone know
the code that will loop through all the files?



.