Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 4 of 4 total
Thread Copy file in store
Wed, Dec 1 2021 6:18 AMPermanent Link

Mirco Malagoli

hi,
I'm trying to copy a file (with TFile :: Copy functions) to a newly created store.
I create the store with "CREATE STORE \" fileIO \ "AS LOCAL PATH ..." then I execute "TFile :: Copy" but the path doesn't exist yet.
If I go to EDB manager and copy a file to the store then the folder is physically created and after all it works.
How can I solve directly from code?
There is a FLUSH or similar command after CREATE STORE?
Thanks!
Wed, Dec 1 2021 6:45 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Mirco


In Delphi I do the following in one of my forms

  if not DirectoryExists(Destination.Text) then begin
   if nlhQuestion('The specified directory does not exist. Do you want it creating?') then begin
    KeepOn := ForceDirectories(Destination.Text);
   end else KeepOn := False;
  end;

ie create the directory before I start creating the store.

Something to remember is that you have the source for EDBManager so you can go and look how it does it.

Roy Lambert
Wed, Dec 1 2021 8:35 AMPermanent Link

Mirco Malagoli

Ok, I haven't looked at the manager code but I don't think it does anything special because with "COPY FILE IN STORE" or "EXPORT TABLE .. IN STORE" the folder is created.
I just don't like doing the operation 2 times in 2 different locations unless the "CREATE STORE" assumes the folder exists and creates it in case it doesn't exist before use.
If so then ok to create it first, because I didn't find anything about it in the manual.
Thank you

Roy Lambert wrote:

Mirco


In Delphi I do the following in one of my forms

  if not DirectoryExists(Destination.Text) then begin
   if nlhQuestion('The specified directory does not exist. Do you want it creating?') then begin
    KeepOn := ForceDirectories(Destination.Text);
   end else KeepOn := False;
  end;

ie create the directory before I start creating the store.

Something to remember is that you have the source for EDBManager so you can go and look how it does it.

Roy Lambert
Wed, Dec 1 2021 12:08 PMPermanent Link

Terry Swiers

Hi Mirco,

> There is a FLUSH or similar command after CREATE STORE?

The CREATE STORE call just adds the store to the catalog for future use.  It won't force the creation of the folder until you do some action against it.   You can create the physical folder using ForceDirectories, or you can use something like the following script to create and force creation at the same time:

SCRIPT
BEGIN
EXECUTE IMMEDIATE 'CREATE STORE "Temp2" AS LOCAL PATH ''Z:\temp2''';
EXECUTE IMMEDIATE 'set files store to "temp2"';
EXECUTE IMMEDIATE 'select * from files range 0 to 0';
END
Image