Quickest AUTOMATED way (in FOXPRO) to determine if ANY files in given Folder are in use
Posted on 2014-10-29
The quickest manual way to determine if any files in a given folder are in use is to try to rename the folder. If you can, then no files are in use, if you can't then something is using one or more of the files.
How would we automate that in vfp9?
So far I've created a simple batch file which returns an exit code thus:
if exist 00test goto renfold
exit /B 1
rename 00test 000test
if exist 000test goto success
exit /B 1
exit /B 0
which returns an exit code of 1 for failure (either because the initial folder didn't exist or the rename failed) and 0 if the rename works.
but although I can run that from vfp (using RUN [BATCHFILE.BAT]) I can't seem to capture the exit code within the vfp environment. (It would be even nicer if we could pass parameters to the batchfile to specify the source and target names but I can live with hard coded names.)