Thanks for all the suggesstions and also for suggesting that I post on the downloads sections, is it okay as I have just modified your code which actually is the bulk or let say the engine for the util.
Regards
Bhavbhuti
>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