I'm building a workflow that needs to process lots of files that I would like to keep on Dropbox. Fortunately, Wolfram/Mathematica appear to support Dropbox, but I've run into a problem (I have submitted a bug report). If there are too many files in your Dropbox folder, using "FileNames" to get the list of file names fails. To determine how many is too many, I wrote a reproducible (at least for me) test case:
dropbox = ServiceConnect["Dropbox"];
testFolder = "/testfilenames";
maxTries = 1000;
Quiet[ServiceExecute[dropbox,
"DeleteDirectory", {"Path" -> testFolder}]];
ServiceExecute[dropbox, "CreateDirectory", {"Path" -> testFolder}];
Module[
{
test,
successes
},
test[i_Integer] := Module[
{
filename,
path,
files
},
Print[i];
filename = "test " <> ToString[i];
path = FileNameJoin[{testFolder, filename}];
ServiceExecute[dropbox,
"Put", {"Path" -> path, "Expression" -> filename}];
files =
ServiceExecute[dropbox, "FileNames", {"Path" -> testFolder}];
i == Length[files]
];
successes = Catch[
Scan[
If[! test[#], Throw[#]] &,
Range[1, maxTries]
];
Throw[maxTries];
];
];
ServiceDisconnect[dropbox];
For me, the above code dies after 500 files.
Before I invest too much more time with Dropbox, I would like to know if it is working for others. Or, if I can expect even more frustration.
Thanks, and have a great and safe week.