If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Rename all files in directory with oldname plus date
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? Thanks for your help Eric |
#2
|
|||
|
|||
Rename all files in directory with oldname plus date
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? |
#3
|
|||
|
|||
Rename all files in directory with oldname plus date
"yyymmdd")
Should be "yyyymmdd") -- Wayne Morgan Microsoft Access MVP |
#4
|
|||
|
|||
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? . |
#5
|
|||
|
|||
Rename all files in directory with oldname plus date
"Eric Blitzer" wrote in message
... Thanks Wayne but I am getting a syntax error on the first line strFileName = Dir "c:\newfiles\*.*" Do I have this right strFileName = Dir("c:\newfiles\*.*") -- I don't check the Email account attached to this message. Send instead to... RBrandt at Hunter dot com |
Thread Tools | |
Display Modes | |
|
|