Last active
August 29, 2015 14:08
-
-
Save ceholden/bbb0dbccc52189275740 to your computer and use it in GitHub Desktop.
Move stacked Landsat images into correct locations for Jake
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
# CD to wherever the data are located, but NOT in the Stacks directory | |
cd [data location] | |
# Don't move the first time around -- do a "dry run" | |
# Redefine "do_move" to 1 to actually move the files | |
do_move=0 | |
# Loop over stacks within "Stacks" directory, moving them into their own folders | |
for stk in Stacks/*stack; do | |
# Find just the Landsat bit of the ID, not the ESPA or the "stack" part | |
# String split on "-" of the filename | |
id=$(basename $stk | awk -F '-' '{ print $1 }') | |
echo "Moving $stk --> $id" | |
if [ "$do_move" == "1" ]; then | |
# Make the directory | |
mkdir -p $id | |
# Now move the stacked image | |
mv $stk $id/ | |
# And .hdr and .aux.xml | |
mv ${stk}* $id/ | |
fi | |
done | |
rmdir Stacks/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment