Public Function DOScommand(comName As String, _
strArg As String)
'******************************************************************************
' *
'Author: Adam Evanovich *
'Date: 10/22/2010 *
'Purpose: To execute a single DOS command. *
' *
'Arguments: *
'comName > Name of the DOS command. *
'strArg > Argument syntax required for the DOS command. *
' Example of both arguments are below: *
' *
' comName = "XCOPY" *
' strArg = "c:\myTextFile.txt c:\myNewFolder\MyTextFile.txt *
' *
'******************************************************************************
Shell Environ("COMSPEC") & " /C " & comName & " " & strArg & ", 1"
End Function '//LL
ok bUT i HAVE 900 FILES TO RENAME
ok bUT i HAVE 900 FILES TO RENAME
based on the level of response from him guy, I would say he would need a bit more of a push than that.Hi. You could try looping through the files in your folder.
ok bUT i HAVE 900 FILES TO RENAME
based on the level of response from him guy, I would say he would need a bit more of a push than that.![]()
dim strFileName as string, strNewName as string
dim str() as string
strFileName = dir("C:\temp\*.*")
do while strFileName <> ""
str = split(strFileName)
strNewName = "C:\temp\" & str(2) & " - " & str(0)
name ("C:\temp\" & strFileName) as strNewName
strFileName = dir
loop
Public Function WriteFiles2Table()
Dim fs, f, f1, fc, s
Dim rs As DAO.Recordset
Dim folderspec
Set rs = CurrentDb.OpenRecordset("tblFiles")
folderspec = "C:\DATAFILES"
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFolder(folderspec)
Set fc = f.Files
For Each f1 In fc
rs.AddNew
rs.Fields("FileName") = f1.Name
rs.Update
Next
Set rs = Nothing
MsgBox "Finished"
End Function