Carnets icon indicating copy to clipboard operation
Carnets copied to clipboard

get files to/from OSX

Open ifuchs opened this issue 3 years ago • 11 comments

What is the best (easiest) way to move .ipynb and data files from a Mac to Carnets?

ifuchs avatar Jun 20 '21 02:06 ifuchs

If the Mac and the iPad or iPhone are connected with a cable, the Finder on the Mac will show the directories on the iPad, under "Files". You can drag files there (and back). If they are not connected, iCloud is probably the easiest. There should be an Carnets folder in iCloud, and you can drag files there.

holzschu avatar Jun 20 '21 06:06 holzschu

Ok, iCloud is the first thing I tried and I eventually after some playing around managed to get a notebook into the folder that would allow me to access it on the iPad. However, I moved a data file into the same directory and I don’t know what the path is to open it in Carnets. If I do an !ls in Carnets I don’t see all of the notebooks in the folder, I only see the one I am working on. How do I access other files? Thanks.

On Sun, Jun 20, 2021 at 2:49 AM Nicolas Holzschuch @.***> wrote:

If the Mac and the iPad or iPhone are connected with a cable, the Finder on the Mac will show the directories on the iPad, under "Files". You can drag files there (and back). If they are not connected, iCloud is probably the easiest. There should be an Carnets folder in iCloud, and you can drag files there.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/holzschu/Carnets/issues/181#issuecomment-864508317, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABLDPSDPIT6FYLOW44KK2NLTTWFOBANCNFSM467TTWDA .

ifuchs avatar Jun 20 '21 12:06 ifuchs

If the file is in Carnets own iCloud folder, Carnets should have access to all the neighbouring files without further action (so if it doesn't, there is something strange). I strengthened the iCloud management in the latest TestFlight version (build 139 for Carnets, https://testflight.apple.com/join/yevwlUs1 ), it might solve the issue.

If the file is outside of Carnets iCloud folder, you need to grant Carnets the rights to access the directory as well as the file, by clicking on the folder icon on the top toolbar.

holzschu avatar Jun 22 '21 17:06 holzschu

I touch the folder icon and select the Carnets notebook directory on my iPad. Then I did an !ls and I get a null result. Obviously, I must be doing something wrong because there must be an easy way to access data files from Carnets. Where am I going wrong?

ifuchs avatar Sep 21 '21 01:09 ifuchs

I accessed a server using scp (via the Files app), in order to open a notebook. That works fine but where is Carnets keeping this file and how to add data files so that the notebook has access?

ifuchs avatar Sep 29 '21 02:09 ifuchs

I do not know where scp has placed the file, locally (I don't know how you used scp from the Files app, I assume there is a helper app). I think the Files app should show you where the file is. Once you know where it is, from Carnets, click on the folder icon and select the parent directory for both the notebook and the data files. Once you're done, you will be able to open data files.

holzschu avatar Sep 29 '21 06:09 holzschu

I use (and highly recommend) the Secure Files app. In Carnets !pwd says:

/private/var/mobile/Containers/Data/Application/87B4749A-0750-4C91-ABDB-F222721BDBA6/tmp/NSIRD_Carnets_x30k1v

How do I put data files in this directory? I cannot find this directory (nor the file) using the files app.

On Wed, Sep 29, 2021 at 2:11 AM Nicolas Holzschuch @.***> wrote:

I do not know where scp has placed the file, locally (I don't know how you used scp from the Files app, I assume there is a helper app). I think the Files app should show you where the file is. Once you know where it is, from Carnets, click on the folder icon and select the parent directory for both the notebook and the data files. Once you're done, you will be able to open data files.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/holzschu/Carnets/issues/181#issuecomment-929866979, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABLDPSCWGWHTHH4A4IYWNULUEKUYDANCNFSM467TTWDA .

ifuchs avatar Sep 29 '21 11:09 ifuchs

You are not supposed to add files to this directory directly. Carnets copies the files it has permission to access locally, and copies them back to the original directory whenever they are updated. If you grant access to a directory, it will copy the content of the directory there.

In order for this to work, the scp app must implement the Apple File Provider API, and not a private API. I would recommend Secure ShellFish, which has all these properties. Or you can scp the directory using the scp command in a-Shell.

holzschu avatar Sep 29 '21 16:09 holzschu

If I understand you correctly the fact that I can open the file in Carnets via the Files app with the Secure Term app (which shows up as a source in the Files app) is not sufficient. Does the fact that it is a source in the files app not imply that it can also be a destination to which Carnets can save the file?

ifuchs avatar Sep 29 '21 21:09 ifuchs

Is there a way in Carnets to show the source directory path of the current notebook?

ifuchs avatar Sep 30 '21 02:09 ifuchs

iOS file access permissions are very restrictive. By opening the file in Carnets, you granted Carnets permission to access the file, but only the file, not the directory around it. The next step is to grant access to the directory, which you do by clicking on the folder icon in the top toolbar, then navigating to the Secure Term source and to the directory that contains the original file and its associated data files and clicking "Open". Once you've done that, and if the Secure Term app does allow read-write permissions for directories, you will have access to the entire directory. image

You can also try opening the directory directly: when you are in Carnets file navigator, navigate to the parent directory of the directory that contains the files you want, then click "Select" on the top right corner, then click the circle that appeared next to the directory you want, then click "Open". You will then see Jupyter familiar file browser, with all files included in the directory you selected. Again, this will only work if the application that stores the files has code to grant permissions to directories, instead of just files.

To answer your other question: from Carnets, the source directory of the current notebook is /private/var/mobile/Containers/Data/Applications/<UUID>/Documents/Folder/file.ipynb, with no way to map the UUID back to the original application. So... I can show it, but it's not going to be very useful.

holzschu avatar Sep 30 '21 05:09 holzschu