1
$\begingroup$

If I use "Save or Publish" button in top right, it uploads notebook and gives me URL of location. What if I forget the location, is there a way to retrieve the ULR later for that notebook?

My current pattern is to copy-paste the following cell into beginning of every notebook. When I run it, it publishes the notebook and inserts URL of the location into the notebook. It's a bit cumbersome.

(* deploys with canonical name *)
deploy := Module[{notebookFn, parentDir, cloudFn, result},
   Print[DateString[]];
   notebookFn = FileNameSplit[NotebookFileName[]][[-1]];
   parentDir = FileNameSplit[NotebookFileName[]][[-2]];
   cloudFn = parentDir~StringJoin~"/"~StringJoin~notebookFn;
   result = 
    CloudDeploy[SelectedNotebook[], CloudObject[cloudFn], 
     Permissions -> "Public", SourceLink -> None];
   Print["Uploading to ", cloudFn];
   result
   ];
deploy
$\endgroup$
2
  • $\begingroup$ I can see mine under my Mathematica Online account. Is that not the case for you? $\endgroup$ Commented Mar 3, 2023 at 20:34
  • $\begingroup$ I can see it, but this takes too many clicks, so wanted a programmatic way $\endgroup$ Commented Mar 3, 2023 at 20:44

1 Answer 1

2
$\begingroup$

You can get a list of all cloud objects with CloudObjects. Also, CloudObjects["dir"] returns all cloud objects in given directory "dir".

Then, you can use First to extract the URL.

First /@ CloudObjects[]

(* {"https://www.wolframcloud.com/obj/domen/Base", 
    "https://www.wolframcloud.com/obj/domen/Desktop", 
    "https://www.wolframcloud.com/obj/domen/Document1.nb", 
    "https://www.wolframcloud.com/obj/domen/Document2.nb", 
    "https://www.wolframcloud.com/obj/domen/Published",
    "https://www.wolframcloud.com/obj/domen/trash", 
    "https://www.wolframcloud.com/obj/domen/userEIWLs"} *)

First /@ CloudObjects["Desktop"]
(* {"https://www.wolframcloud.com/obj/domen/Desktop/Document3.nb"} *)
$\endgroup$
1
  • $\begingroup$ Thanks, looks like I can use this to do this to get the published name: fn[s_] := Last@FileNameSplit[s]; Select[CloudObjects["Published"], fn@First@# == fn@NotebookFileName[] &] $\endgroup$ Commented Mar 5, 2023 at 0:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.