Re: Move files based on filename string matches?
From: J French (erewhon_at_nowhere.com)
Date: 03/08/04
- Next message: Paul: "Re: Please help: Numeric class properties"
- Previous message: Andrew Dunn: "Re: Unload - Need advice - Code still running"
- In reply to: Rick Rothstein: "Re: Move files based on filename string matches?"
- Next in thread: Bob O`Bob: "Re: Move files based on filename string matches?"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 8 Mar 2004 09:36:54 +0000 (UTC)
On Sun, 7 Mar 2004 14:24:37 -0500, "Rick Rothstein"
<rickNOSPAMnews@NOSPAMcomcast.net> wrote:
<snip>
>>
>> On balance, I reckon it is better to break things down into small
>> discrete tasks - it makes code simpler to follow
>
>Something like this maybe (where I did not list the non-moved files)?
<snip>
While that would work fine, no, that is not how I would code it
(although much of the same code would be there)
I would have something rather like this :-
Private Type TCMN
SrcPath As String
FoundItems() As SomeUDT
KeyWords() As String
...
End Type
Private cmn As TCMN
Private Sub LS_SetupControl( Er As Boolean )
Dim A() As String
Call LS_GetKeyWords( cmn.KeyWords() )
' --- Generic Routine
Call GS_ReadFilesToArray( cmn.SrcPath + "*.*", A$(), Er )
If Er Then Exit Sub ' Fatal Error
Call LS_ArrayToFoundItems( A$(), cmn.FoundItems() )
' --- Local Routine, can work on multiple 'data arrays'
Call LS_ProcessKeyWords( cmn.KeyWords(), cmn.FoundItems() )
' ---- Initial Display
Call LS_PopulateUserSelectionDisplay( "", cmn.FoundItems() )
' ---- Hand over control to User selection GUI
End Sub
Notice that I'm deliberately passing module level variables into local
routines.
What I'm trying to say is that mostly I don't care /how/ something is
done - just that a routine gets an input, and provides an output
- whether GS_ReadFilesToArray( FileSpec$, A$(), Er )
uses Dir() or FindFirst/FindNext is not relevant to the App
- where the KeyWords() come from, and how they are extracted is of
total irrelevance
I think you need to look at this :-
If Not FileExists(Directory & Group(X).Keyword) Then
MkDir Directory & Group(X).Keyword
End If
IMO FileExists() and DirExists() should be different contructs
The problem with 'heavy' routines is that one's eye is taken off the
minute details
- for example how should one handle the case where a file of the same
name exists in the SrcPath and the DestPath ?
- Next message: Paul: "Re: Please help: Numeric class properties"
- Previous message: Andrew Dunn: "Re: Unload - Need advice - Code still running"
- In reply to: Rick Rothstein: "Re: Move files based on filename string matches?"
- Next in thread: Bob O`Bob: "Re: Move files based on filename string matches?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|