Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
FPD25 New version of FLS.EXE
Message
From
12/11/2001 09:07:45
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
General information
Forum:
Visual FoxPro
Category:
FoxPro 2.x
Miscellaneous
Thread ID:
00577869
Message ID:
00580426
Views:
23
This looks interesting; I'll test it tomorrow, at work.

For now, I have the following ideas, to make it more useful:

  • Whenever you post code, use the HTML tag < PRE > (omit the spaces). This will make it more readable on the UT.
  • I think the function would be more useful as a function that accepts parameters. Thus, you can use it from within a program, without asking the user for data. The input commands you put may be useful too, but they should be a separate function, that passes the parameters (typed by the users) to the main function.
  • Finally, you may want to post your function in the Universal Thread, under FAQ or Downloads, to make it available to a large number of developers. The title might be something like: "Process all files in a folder".

    Hilmar.

    >Hey Hilmar
    >
    >Here is my FLS.PRG based on your code, hope it comes in handy to you:
    >* FLS.PRG
    >
    >PUBLIC gcPathNameSkel, gcBatchFile, gcBeforeFName, gcAfterFName
    >
    >gcPathNameSkel = PADR("C:\*.*", 80)
    >gcBatchFile = PADR("C:\FileList.BAT", 80)
    >gcBeforeFName = SPACE(80)
    >gcAfterFName = SPACE(80)
    >
    >
    >CLEAR
    >
    >@ 6, 10 SAY " File Skeleton: " GET gcPathNameSkel
    >
    >@ 8, 10 SAY " Batch File Name: " GET gcBatchFile
    >
    >@ 10, 10 SAY "Text to Put: "
    >@ 11, 10 SAY "Before File Name: " GET gcBeforeFName
    >@ 12, 10 SAY " After File Name: " GET gcAfterFName
    >READ
    >
    >
    >SET ALTERNATE TO (ALLTRIM(gcBatchFile))
    >SET ALTERNATE ON
    >
    >RecurseWithSub(ALLTRIM(gcPathNameSkel))
    >
    >SET ALTERNATE OFF
    >SET ALTERNATE TO
    >
    >
    >FUNCTION RecurseWithSub(tcFullPath)
    > LOCAL lcDir, lcSkeleton
    >
    > lcDir = JUSTPATH(tcFullPath)
    > lcSkeleton = JUSTFNAME(tcFullPath)
    >
    > FilesSub(lcDir, lcSkeleton)
    >ENDFUNC
    >
    >
    >FUNCTION FilesSub(tcDir, tcSkeleton)
    > LOCAL laFileList(1,1), i, lcDir
    >
    > FOR i = 1 TO ADIR(laFileList, tcDir + "\" + tcSkeleton)
    > ?? ALLTRIM(ALLTRIM(gcBeforeFName) + " " + tcDir + "\" + laFileList(i, 1) + " " + ALLTRIM(gcAfterFName))
    > ?
    > NEXT
    >
    > FOR i = 1 TO ADIR(laFileList, tcDir + "\*.*", "D")
    > IF laFileList(i, 1) # "."
    > lcDir = tcDir + "\" + laFileList(i, 1)
    >
    > FilesSub(lcDir, tcSkeleton)
    > ENDIF
    > NEXT
    >ENDFUNC
    Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
  • Previous
    Next
    Reply
    Map
    View

    Click here to load this message in the networking platform