1 Copper

How to store a windows directory (folder) on centera?

I can store files (txt, jpg, zip ) on centera and retrieve it back but i want to know is there is a way to store a directory (folder) on centera

0 Kudos
4 Replies
8 Krypton

Re: How to store a windows directory (folder) on centera?

How are you storing the files you mention? That would have a strong bearing on how directories would be stored.

Mike Horgan

0 Kudos
1 Copper

Re: How to store a windows directory (folder) on centera?

Here is the store code C#

static void Main(string[] args)




                String clusterAddress = "";

               String fileName = "e:\\CAS\\ww.zip";//"e:\\CAS\\aa.txt"

                String blobString = "5000";

                int blobThreshold = Int32.Parse(blobString);


                if (blobThreshold > 0)

                    FPLogger.ConsoleMessage("\nContent less than " + blobString + " bytes will be embedded in the CDF.");


                    FPLogger.ConsoleMessage("\nContent will never be embedded in the CDF.");

                FPPool.EmbeddedBlobThreshold = blobThreshold;

                 FPPool thePool = new FPPool(clusterAddress);

                // Create the clip

                FPClip clipRef = new FPClip(thePool, fileName);

                clipRef.RetentionExpiry = new DateTime(2015, 10, 10);

  // Or you could set this using a TimeSpan

  //clipRef.RetentionPeriod = new TimeSpan(500, 12, 20, 30);


            clipRef.SetAttribute("OriginalFilename", fileName);

            FPTag fileTag = clipRef.AddTag("StoreContentObject");

            fileTag.SetAttribute("filename", fileName);


                // Write the content of the file to the Centera

                FPStream streamRef = new FPStream(fileName, 16 * 1024);

                fileTag.BlobWrite(streamRef, FPMisc.OPTION_CLIENT_CALCID);


                long blobSize = fileTag.BlobSize;

                if (blobThreshold > 0 && blobSize < blobThreshold)

                    FPLogger.ConsoleMessage("\nContent was embedded in the CDF as size "

                        + blobSize

                        + " is less than the threshold.");


                String clipID = clipRef.Write();

                /* Write the Clip ID to the output file, "inputFileName.clipID" */

                String outFileName = fileName + ".clipID";

                FPLogger.ConsoleMessage("\nThe C-Clip ID of the content is " + clipID);

                FileStream outFile = new FileStream(outFileName, FileMode.Create);

                StreamWriter outWriter = new StreamWriter(outFile);








            catch (FPLibraryException e)


                ErrorInfo err = e.errorInfo;               

                 FPLogger.ConsoleMessage("\nException thrown in FP Library: Error " + err.error + " " + err.message);



0 Kudos
8 Krypton

Re: How to store a windows directory (folder) on centera?

Ah, I thought you might be writing code for this but wasn't sure. How about just creating a .zip of the files in your directory and pushing that up to Centera?

0 Kudos
1 Nickel

Re: How to store a windows directory (folder) on centera?

To answer your question: No, there is no way to store a directory on Centera.  If you examine your code closely you'll see that (despite your original post) you are not storing files on Centera, either.  You are storing blobs.

Now, as to a solution, if you wish to simulate storing a directory, you could walk your directory and stream each file to a different blob in your C-Clip, one per tag.  You could use the tag's attributes to store the original file name.

You could also zip them up as Mike Horgan suggested, and store the zip in a single blob.

0 Kudos