Boris
That looks great
Thanks
Colin
>>Hi
>>
>>I have a direrctory which contains a stack of BMP files - many of the file names are wrong - I can tell if a file is wrong by looking at the first character of the file name - based on what the first character is I know what the filename should be corrected to
>>
>>Has anyone any code that would help me do this?
>>
>>Thanks
>>
>>Colin
>
>
>RenameBadNames([c:\SomeFolder\*.BMP])
>
>
>FUNCTION RenameBadNames(lcFilePattern)
> LOCAL lnFiles, laFiles[1], lnFor
> LOCAL lcFilePath
> lcFilePath = ADDBS(JUSTPATH(lcFilePattern))
> lnFiles = ADIR(laFiles, lcFilePattern)
> FOR lnForm = 1 TO m.lnFiles
> IF LEFT(laFiles[lnFor,1]) == [BADCHAR]
> lcOldName = lcFilePath+laFiles[lnFor,1]
> lcNewName = lcFilePath+[PUT THE NEW NAME HERE]
> RENAME (lcOldName) TO (lcNewName)
> ENDIF
> NEXT
>RETURN .t.
>
Specialist in Advertising, Marketing, especially Direct Marketing
I run courses in Business Management and Marketing