remove .icloud file extension to work with fcs parser python jupyter

Viewed 112

I am importing data into jupyter notebook from iCloud like so:

data_path_training = "/Users/Mady/Library/Mobile Documents/com~apple~CloudDocs/Data/Training"

files_training = os.listdir(data_path_training)

The start of files_training looks like:

['.Gates_PTLG024_BL_Unstim_CD235-CD61-_unstim_1st__BL__PTLG024.fcs.icloud', '.Gates_PTLG003_1_Unstim_CD235-CD61-_unstim_2nd___1___PTLG003.fcs.icloud', '.Gates_PTLG016_2_Unstim_CD235-CD61-_unstim_3d___2___PTLG016.fcs.icloud'

and similar for validation. I am using fcs parser on them, but the problem is that there's a .icloud file extension along with the .fcs, which is causing the error message "not a valid fcs file." How do I remove this .icloud extension in jupyter notebook python?

1 Answers

.*.icloud files are simply "links" to relevant files in your iCloud account. If you open a Finder window, you will see to the right of the file a small icon representing a cloud with a downward arrow. Click on the icon to download the "real" file, and be able to use it in your script.

To avoid such manual operation you can either:

  1. untick the Optimise Mac Storage checkbox at the bottom right of System Preferences -> Apple ID; or
  2. use brctl download .*.icloud in a console (so, scriptable) to download the file(s) you need.
Related