I have a directory where I store backups. The are in the format
Complete Backup YYYY-MM-DD hh-mm-ss.tar.bz2 I have found out that you can feed a date into the
date command using
date --date="YY-MM-DD hh:mm:ss".
So how would I get a space separated list of dates. The dates should have run through a call of
date so that they are formated.
I came up with this command that gives me a list (one entry per line) in the format of
YYYY-MM-DD hh-mm-ss. So how would I format it correctly and do a date on every one of them and the seperate them with a space?
dir backups/ | grep '[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]\\ [0-9][0-9]-[0-9][0-9]-[0-9][0-9]\.tar\.bz2$' | sed 's/\\//g' | sed 's/\.tar\.bz2//g' | sed 's/Complete Backup //g'
Note: The output will be use in a select loop so every space belonging to a date should be escaped.