Randomize group of modification dates

This is an unusual request. I'm not sure why you would want to do this but it sparked my interest. We'll use jot to pick us a random number between 1 and 16000.

jot -r 1 1 16000

This will be the number of hours we subtract from the current date.

seed=$(jot -r 1 1 16000)
date -v-"$seed"H "+%Y%m%d%H%M.%S"

Note that date above, formats the date to work with touch.

Now we use find to list all the directories within the current working directory and use an "inline" script to touch all the filesystem objects within each directory with a unique modification time in each directory.

find . ! -name '.' -type d -exec bash -c ' for dir
    do
        seed=$(jot -r 1 1 16000)
        echo touch -t "$(date -v-"$seed"H "+%Y%m%d%H%M.%S")" "${dir}/"*
    done
' sh {} \;

We are not done yet because we have indiscriminately changes the modification times of nested directories. We want unique mod times for each directory.

find . ! -name '.' -type d -exec bash -c ' for dir
    do
        seed=$(jot -r 1 1 16000)
        echo touch -t "$(date -v-"$seed"H "+%Y%m%d%H%M.%S")" "${dir}"
    done
' sh {} \;

And to put it all together-

#! /bin/ksh

find . ! -name '.' -type d -exec bash -c ' for dir
    do
        seed=$(jot -r 1 1 16000)
        echo touch -t "$(date -v-"$seed"H "+%Y%m%d%H%M.%S")" "${dir}/"*
    done
' sh {} \;


find . ! -name '.' -type d -exec bash -c ' for dir
    do
        seed=$(jot -r 1 1 16000)
        echo touch -t "$(date -v-"$seed"H "+%Y%m%d%H%M.%S")" "${dir}"
    done
' sh {} \; 

This script could fail if you exceed ARG_MAX and currently will only list the changes that touch would make. You can remove the echo in front of touch to make the changes. Please be aware that this script has only limited testing and is offered AS IS.