Created
October 21, 2013 18:55
-
-
Save cwvhogue/7088988 to your computer and use it in GitHub Desktop.
Draft - retrieve a Manta Directory Hierarchy and File content on a Unix/Linux platform. Works with spaces in path names.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Phase 1 Retrieves directories, creates hierarcy from current working directory. | |
mfind -t d ~~/stor/winfoo | sed "s,/$MANTA_USER/stor/,," | xargs -I {} mkdir -p "{}" | |
# This retrieves object paths, splits into download file and target local directory file | |
# Phase 2 retrieves objects, splits into source/target directories, calls mget | |
mfind -t o ~~/stor/winfoo | tee dnldfiles.txt | sed -e "s,/$MANTA_USER/stor/,," | xargs -I {} dirname "{}" > dnlddirs.txt | |
# the dnlddirs.txt file can be prepended with a target directory or windows-ified | |
cat dnldfiles.txt | xargs -I {} basename "{}" > dnldnames.txt | |
paste -d '/' dnlddirs.txt dnldnames.txt > targets.txt | |
paste -d '"' dnldfiles.txt targets.txt > dnldsets.txt | |
# put quotation marks at front and end of each line... stick in -o .. run mget | |
sed -e 's/\"/\" -o \"/g' -e 's/$/"/' -e 's/^/\"/' dnldsets.txt | xargs mget | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment