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

Helper class - possible to add directory GET #57

Open
stephenmcconnachie opened this issue Apr 29, 2023 · 9 comments
Open

Helper class - possible to add directory GET #57

stephenmcconnachie opened this issue Apr 29, 2023 · 9 comments

Comments

@stephenmcconnachie
Copy link

No description provided.

@stephenmcconnachie
Copy link
Author

It would be really useful if a 'GET whole directory' helper could be developed, for cases where a bucket has a sub directory structure, and the user needs to GET all files from a directory, including subfolders and their files.

@berkeleysquare
Copy link
Contributor

berkeleysquare commented Apr 29, 2023

It would be really useful if a 'GET whole directory' helper could be developed, for cases where a bucket has a sub directory structure, and the user needs to GET all files from a directory, including subfolders and their files.

Stephen -- I might have misunderstood tyour request, but have you seen the Prefix attribute? If you get_bucket with the prefix "my/folder/" you would get a listing of all the files "under" that folder. It's just a string match, but it does what I think you're looking for.

@stephenmcconnachie
Copy link
Author

stephenmcconnachie commented Apr 30, 2023

Thanks John!

I was thinking of a GET all objects rather than get list of objects, so equivalent to this getting_all_objects_in_bucket.py - https://github.com/SpectraLogic/ds3_python3_sdk/blob/623f2997121d850a8b9b989fcbc8ecae45d9a2b6/samples/getting_all_objects_in_bucket.py - but with ability to specify the folder only. So imagine the prefix function from getBucket.py, but to get the objects themselves not just a list of them.

The CLI has a method to do this - get_bulk - https://developer.spectralogic.com/java-command-line-interface-cli-reference-and-examples/ - but it would be great to have it in the Python sdk.

@stephenmcconnachie
Copy link
Author

This is an example of how to achieve this in the CLI (with an output to txt file for a log) - it works perfectly there, but would be great to have similar in the Python...

/mnt/path/to/CLI/bin/ds3_java_cli -e 111.11.11.11 -a key -k key -c get_bulk -b backup_bucket -p "Hard Drive 12/folder_7" -d /mnt/path/to/stephen_bp_cli_test --http --verbose >> /mnt/path/to/stephen_bp_cli_test/folder_7.txt

@gtrossell
Copy link

@stephenmcconnachie we are looking into this and working out where in our current development cycles we can slot this feature in.

@stephenmcconnachie
Copy link
Author

Thanks very much @gtrossell

@berkeleysquare
Copy link
Contributor

@stephenmcconnachie -- just merged a PR to do this. The get_all_files_in_bucket now takes a prefix string.

@gtrossell
Copy link

@stephenmcconnachie - we have added in a fix to master, if you want to pull it down

@stephenmcconnachie
Copy link
Author

That's fantastic, thank you!

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

3 participants