Saluti
Sam Torpedo
Metti i gruppi in directory diverse e ripeti la procedura per ciascuna
directory.
Ciao.
eSQueL
sì sarebbe stata un'ottima soluzione con pochi gruppi ma rifacendo i
calcoli i gruppi sarebbero 1340 e i file da rinominare oltre 5000!!
gasp!
--
saluti
Sam Torpedo
Option Compare Database
Option Explicit
' by AlexCara
Private Items As New Collection
Function getItem(pParm As String)
Dim idx As Long
Dim oL As Variant
On Error Resume Next
idx = InStr(pParm, ".")
If pParm = "" Then
Set getItem = Items
Else
If idx = 0 Then
getItem = Items(pParm)
If Err.Number <> 0 Then
Err.Clear
Set getItem = Items(pParm)
End If
If Err.Number <> 0 Then getItem = "undefined"
Else
Set oL = Items(Left(pParm, idx - 1))
Set getItem = oL.getItem(Mid(pParm, idx + 1))
End If
End If
End Function
Sub setItem(pParm As String, pValue As Variant)
Dim idx As Long
Dim oL As Variant
On Error Resume Next
idx = InStr(pParm, ".")
If idx = 0 Then
Items.Remove (pParm)
Items.Add pValue, pParm
Else
Set oL = Items(Left(pParm, idx - 1))
If Err.Number <> 0 Then
Set oL = New cAxaSimple
setObject Left(pParm, idx - 1), oL
End If
oL.setItem Mid(pParm, idx + 1), pValue
End If
End Sub
Private Function setObject(pParm As String, pValue As Variant)
On Error Resume Next
Items.Remove (pParm)
Items.Add pValue, pParm
End Function
e funziona------------------
questo e' il codice per fare quello che vuoi (e funziona)
la funzione la ho messa in un modulo
Option Compare Database
Option Explicit
Function GetFilesOperativi(folderspec) As String
Dim fs, f, f1, fc, s
Dim oName As New cAxaSimple
Dim aName As Variant
Dim i As Long
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFolder(folderspec)
Set fc = f.Files
i = 0
For Each f1 In fc
aName = Split(f1.Name, ".")
oName.setItem Left(aName(0), 4) & "." & aName(0), aName(0)
Next
Set s = oName.getItem("")
For Each f1 In s
Set fc = f1.getItem("")
i = 1
For Each f In fc
Debug.Print f & ".jpg", Left(f, 4) & "-" & i & ".jpg"
i = i + 1
Next
Next
End Function
NOTE:
modificare la debug.print con la istruzione di rename
se vuoi il progressivo formattato:
Debug.Print f & ".jpg", Left(f, 4) & "-" & format(i,"0000") & ".jpg"
ATTIVAZIONE:
lanciare con : GetFilesOperativi("pathinteressato")
LIMITI:
ovviamente funziona per access>97
e solo per i jpg con caratteristiche del nomefile uguale al tuo.
Per renderla "allpourposes" sono necessari un po (nel senso di fiume, in
verita' non molti) aggiustamenti.
1) gestire l'extension
2) gestire il modello del file inp/out
--
ac
Dim mFormat as string
Dim mExtension as variant
Property Let Formato(strIN as string)
mFormat=strIn
End Property
Property Get Formato as String
Formato=mFormat
End property
Property Let Estensioni(ParamArray Extension())
mExtension=Extension()
End Property
bla...bla...bla....
@Alex
> questo e' il codice per fare quello che vuoi (e funziona)
FUNZIONA davvero!!
grazie Alessandro!
Ciao
--
Sam Torpedo