This is similar to How to list folders using bash commands?. I have a folder structure of the format foo/YYYY/MM/DD/HHMM (at 10 minute intervals). What is the easiest way to get the previous and next folder's name?
I thought of
sTimeNow=$(date "${iYear}/${iMnt}/${iDay} ${iHr}:${iMin):00")
sTimeBefore=$(date "${sTimeNow} - "10 minutes")
sTimeAfter=$(date "${sTimeNow} + "10 minutes")
and with a bit (understament...) of formatting could get the two directories.
However the date maths probably not the best way to go about it, and I have missing dates (which is my ultimate aim to fix)
Also thought of populating a list
MyList='ls -dr *"
iFolder= get current folder index (how?)
sFolderBefore=$Mylist[${iFolder}-1] so much easier
sFolderAfter=$Mylist[${iFolder}+1]
(all the above likely to have syntax errors, apologies novice)