8 if [[ -z $source ||
-z $dest ]]; then
9 echo 'usage: uploadbuckets.sh <source> <dest>'
10 echo 'Script runs in DRYRUN mode by default.'
11 echo 'To run for real, set DRYRUN=0 in your environment.'
15 if [[ ! -d $source ]]; then
16 echo 'error: source is not a directory'
20 if [[ -e $dest && ! -d $dest ]]; then
21 echo 'error: dest is not a directory'
25 if [[ $
(readlink
-e $dest) = $
(readlink
-e $source) ]]; then
26 echo 'error: source and dest cannot be the same. Rotate the result'
27 echo 'into place once the migration is complete.'
31 if [[ ! -d $dest ]]; then
37 for package
in "$source"/*; do
38 pkgname
="${package##*/}"
39 newfolder
="$dest/${pkgname:0:2}"
40 if [[ ! -d "$newfolder" ]]; then
41 if [[ $DRYRUN -gt 0 ]]; then
42 echo mkdir
-p "$newfolder"
47 if [[ $DRYRUN -gt 0 ]]; then
48 echo mv "$source/$pkgname" "$newfolder/$pkgname"
50 mv "$source/$pkgname" "$newfolder/$pkgname"
54 if [[ $DRYRUN -gt 0 ]]; then
56 echo 'DRYRUN mode was enabled.'
57 echo 'To run for real, set DRYRUN=0 in your environment.'