[fpc-pascal]Deleting the current directory (after changing it)

Peter Vreman peter at freepascal.org
Mon Mar 18 09:09:19 CET 2002

> Removing the current directory
> Back in the good old days of 16-bit Borland Pascal under DOS I had a
> utility which (among other things) would change directory to the parent
> and the delete the old working directory.  It worked perfectly.  A
> simplified listing appears below.
> But when I compile it for Win 32 under Free Pascal and run it under
> Windows 2000, it crashes with Access Denied (Runtime error 5) when it
> tries to delete the old current directory.
> As I recall, this problem was previously noted in this forum and it
> was explained that, although the program has changed its own working
> directory to the parent, the command shell in which it runs is still
> using the working directory that it was when the program was first
> launched.
> OK, that's all well and good, but I miss the functionality of my
> little utility, and I want to get it back.  Can anyone suggest a
> workaround that really does work?

A batchfile ?

More information about the fpc-pascal mailing list