Message Boards Message Boards

0
|
3015 Views
|
2 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Import my scripts from Cloud to open with Mathematica?

Posted 2 years ago

After discovering the time limitation on doing integrations on the cloud, I purchased Mathematica. However, although I can open from the cloud, I can't find an option to import my cloud scripts to Mathematica desktop so I can run without the cloud. Where is it?

POSTED BY: James Bowery
2 Replies
Posted 2 years ago

For a single cloud file you can use the cloud menu option File/Download. And then open that file in Mathematica Desktop,

enter image description here

POSTED BY: Hans Milton
Posted 2 years ago

Hi James,

You can manually download each cloud notebook by selecting Download from the File menu. This is tedious if you have a lot of notebooks. I wrote a function to download all cloud notebooks. It only handles two levels of sub-directories. Fairly straightforward to extend if you have more.

cloudToLocal[localBase_] := 
 Module[{objects, types, allObjects, allPaths, directories},
  PrintTemporary["Getting list of top level objects"];
  objects = CloudObjects@CloudDirectory[];
  PrintTemporary["Getting top level object types"];
  types = Information[#, "FileType"] & /@ objects;
  PrintTemporary["Getting list of second level objects"];
  allObjects = 
   Flatten[
    MapThread[
     If[#2 === Directory, CloudObjects[#1], #1] &, {objects, 
      types}]];
  PrintTemporary["Getting paths"];
  allPaths = Information[#, "Path"] & /@ allObjects;
  directories = 
   FileNameTake[#, {1, -2}] & /@ allPaths // DeleteDuplicates;
  CreateDirectory@FileNameJoin@{localBase, #} & /@ directories;
  PrintTemporary[
   "Copying " <> ToString[Length@allObjects] <> " files"];
  MapThread[
   CopyFile[#1, FileNameJoin@{localBase, #2}] &, {allObjects, 
    allPaths}];
  ]

To use it e.g.

cloudToLocal["~/Documents/Wolfram/CloudBackup"]

Depending on the number of cloud files you have it can take a while for the copy to complete.

POSTED BY: Rohit Namjoshi
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract