Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

folder structure and description of added files not being preserved #13

Open
cristobaltapia opened this issue Jul 14, 2023 · 1 comment

Comments

@cristobaltapia
Copy link

Hi,

I was trying to upload a bunch of files with descriptions directly with easyDataverse but I am having a little issue. Although the files are uploaded, the information corresponding to the folder structure and file description is lost. Does this happen to anyone else, or is it just me?

Cheers

@kbrueckmann
Copy link

I'm not one of the developers, but as far as I know the default description is an empty string. So if you update a file that previously did have a description without overwriting the default that description will be lost.
Regarding the folder structure: I had no problems here; I just noticed that the files in folders won't get the categories and descriptions I specified if I add them as directories. As I didn't see any parameters to change that behaviour, I iterate over the data like this and use the add_file()-method:

    for dir_path, dir_names, file_names in os.walk(path):
        for file_name in file_names:
            dataset.add_file(
                         local_path=dir_path + "/" + file_name,
                         categories=categories,
                         dv_dir= "" if dir_path == f"{path}" else re.sub(f"{path}/", "", dir_path, 1),
                         description=description) 

The weird regex is just there to remove the folder in which I store all the data from the path.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants