"OUTPUT TO" and Folder Creation

KMoody

Member
Progress: 10.2b SP7
OpenEdge Architect: 3.4.2.R342_v20090122-9I96EiWElHi8lheoJKJIvhM3JfVsYbRrgVIWL
OpenEdge OS: Windows 7 Professional 2002 SP1

I need to recreate our current live environment in two other environments, and our team has discovered a potential problem.

If a folder in an "OUTPUT TO" file path does not exist, then the statement throws an error. For example, if C:/abc/ and/or C:/abc/123/ did not exit, then "OUTPUT TO C:/abc/123/" would fail.

Is there some way to force an output statement to create path folders if they do not exist? Otherwise, we will need to dig through our code, find every OUTPUT TO path, and recreate them in our two new environments.
 
Last edited:

GregTomkins

Active Member
There is no way that I know of, but, you could write straightforward code to test for each potentially missing folder, and create them as needed using OS-CREATE-DIR. Of course you need to make sure that all ID's that might do this have the necessary permissions.
 

4GLNewbie

Member
I m thinking about why, if your program has to create an output to a folder .. does not create the directory or even checks if exists.
To recreate all the structure .. you should retrieve the path information and create it if does not exists ..

But.. are you sure you can't use some line-command to do it properly ?
 

GregTomkins

Active Member
That's OK if you are dealing with one installation but if your app is deployed across a zillion customers ... or even a handful, it might suck.
 

4GLNewbie

Member
What do you use to do it does not matter a lot (a setup or with scripts or something else), but you'll have to reproduce your application directory tree.. should be one of the first things to do. Or else nothing will work.
No way you can go around this step.

If you want to do it from progress maybe there are different ways to create it. A recursive function? A single call to os-create-dir? I dont know, i did not try.
AFAIK i work on an ancient and obsolete version of progress :p
 

KMoody

Member
What do you use to do it does not matter a lot (a setup or with scripts or something else), but you'll have to reproduce your application directory tree.. should be one of the first things to do. Or else nothing will work.
No way you can go around this step.

If you want to do it from progress maybe there are different ways to create it. A recursive function? A single call to os-create-dir? I dont know, i did not try.
AFAIK i work on an ancient and obsolete version of progress :p

Recreating the entire directory structure wouldn't be too hard - except that we have hundreds human-created folders mixed in with progress folders in our current environment. Currently, we cannot tell which folders our progress programs need to run and which are "garbage." To do this, I would need to find every iteration of "OUTPUT TO" or "INPUT FROM", parse the folder argument, and add it to a folder list. This task becomes even more complex with variable folder or file names.

I can parse through our programs, but I'd rather use a more elegant solution if I can. Based on Greg's suggestion, I might create a universally accessible function that creates missing folders before attempting "OUTPUT TO" or "INPUT FROM".
 

Rob Fitzpatrick

ProgressTalk.com Sponsor
I can parse through our programs, but I'd rather use a more elegant solution if I can. Based on Greg's suggestion, I might create a universally accessible function that creates missing folders before attempting "OUTPUT TO" or "INPUT FROM".

It would be a good idea for your function to test that the client has the required read/write permissions on the directory, in addition to checking for its existence.
 
Top