Iteratively downloading Dropbox Desktop files stored in cloud one at a time to process and then deleting

3 次查看(过去 30 天)
I have a large (150 GB) Dropbox Desktop directory "/Users/myuser/Dropbox/New Data" which is stored in "online" mode, so these files are not currently downloaded on my SSD (I can double click them to download and open). Within this directory are many subfolders of subfolders of files - the files I want are the file pairs of "EventList.xlsx" and the edf file present in each of the smallest folders. I want to run a function "myfunction" on each of these file pairs and store the outputs in a matrix.
I tried:
DBdir = "/Users/myuser/Dropbox/New Data";
EL = "EventList.xlsx";
TDir1 = tempname() + ".cache";
TDir2 = tempname() + ".cache";
mkdir(TDir1);
mkdir(TDir2);
X = [];
edfinfo = dir(DBdir + '/**/*.edf');
edfnames = fullfile({edfinfo.folder}, {edfinfo.name});
numedf = numel(edfnames);
for K = 1 : numedf
thisedf = edfnames{K};
[thisfolder, thisbase, thisext] = fileparts(thisedf);
thisEL = fullfile(thisfolder, EL);
copyfile(thisedf, TDir1, 'f');
copyfile(thisEL, TDir2, 'f');
Tedfname = fullfile(TDir1, [thisbase thisext]);
TELname = fullfile(TDir2, EL);
try
A = myfunction(TELname, Tedfname);
X = [X; A];
end
try delete(Tedfname); end
try delete(TELname); end
end
save('X.mat','X')
The problem I am encountering is that when I reach copyfile, then I am copying a blank edf file to the temporary directory TDir1 and a blank Excel file to the temporary directory TDir2. If I go to the first smallest subfolder in my Dropbox Desktop and double click the edf and Excel files I want to download them to my SSD and then run this code, it will successfully run the complete the first loop, but then result in an error in the second iteration of the for loop since the next file pair isn't downloaded.
Does anyone know how I can fix?

回答(1 个)

Animesh
Animesh 2023-5-31
Hi Shri,
I understand that you want to download files from your Dropbox folder with the help of MATLAB.
To download files from Dropbox you can use this file from MATLAB file exchange :
This file consistes of a function named downloadFromDropbox which can be used to download files from Dropbox.

类别

Help CenterFile Exchange 中查找有关 Downloads 的更多信息

标签

产品


版本

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by