Dateienumbenennen

Hallo Experten

wie programmiere ich ein stapelverarbeitungsprogramm, bei
der in einem bestimmtem verzeichnis eine bestimmte anzahl an
dateien sind. diese sollen umbenannt werden: von z.b. pic001 und pic002 in pic233 und pic234.

das ganze soll vielleicht unter access2000 laufen

danke

pius

schau mal das FileSystemObject an. Unter Projekt, Verweise „Microsoft Scripting Runtime“.

Gruss,
DaHo

Hi!
Ich hab dir da mal was hingehackt. mit CommandButton1_Click wird das ganze aufgerufen.

------------------------------------------begin copying here :smile:
'by Thomas '03
'##########################################
'Konfiguration
Const stellenanzahl = 4
'z.b. xxxxx0001.jpg /\
’ ^^^^ „“, „“, „“) & sFiles(x) As path & IIf(Right(path, 1) „“, „“, „“) & Left(sFiles(x), Len(sFiles(x)) - (stellenanzahl + 4)) & Format(Val(Right(sFiles(x), (stellenanzahl + 4))) + 100, String(stellenanzahl, „0“)) & Right(sFiles(x), 4)
Next x
MsgBox „Finished!“, vbInformation, „finished!“: End
End Sub

Private Function AllFiles(ByVal FullPath As String) As String()
'***************************************************
'a little bit modified by me!
'http://wwww.freevbcode.com/ShowCode.asp?ID=1331
'************************************************

Set oFs = CreateObject(„Scripting.FileSystemObject“) 'ausgetauscht>>> scriptsupport!
Set oFolder = oFs.GetFolder(FullPath)
Set oFile = oFolder.Files
Dim sAns() As String
Dim lElement As Long

ReDim sAns(0) As String
If oFs.FolderExists(FullPath) Then
Set oFolder = oFs.GetFolder(FullPath)

For Each oFile In oFolder.Files
lElement = IIf(sAns(0) = „“, 0, lElement + 1)
ReDim Preserve sAns(lElement) As String
sAns(lElement) = oFile.Name
Next
End If

AllFiles = sAns
ErrHandler:
Set oFs = Nothing
Set oFolder = Nothing
Set oFile = Nothing
End Function

ich hoffe das hilft dir weiter =)

grüsse
thomas
[email protected]