byuitechops / build-file-structure

Reorganizes the file structure of a course during conversion.
0 stars 0 forks source link

Should we delete non-empty folders? #5

Open danverde opened 6 years ago

danverde commented 6 years ago

https://github.com/byuitechops/build-file-structure/blob/d08a573e9e93e87ce16d6a736629e05a0b48f5b9/main.js#L99

We check to make sure the folder is empty before deleting it, but the API call has the force flag that tells Canvas to delete the folder even if it's not empty. So... which one should we do?

csammcgrath commented 6 years ago

I think it already checks for the folder length - folder.files_count === 0. Because of this, I don't know why the force flag is included in the api call. If there is a folder that is not supposed to be there and has stuff in it, we should at least archive it and then delete the folder. That way, we are not losing any files.