I'm trying to beat my head against the syntax of this. I'm getting problems with whitespaces and I can't see if there's a better way to do this.
vardir=/home/user cd $vardir for i in $(ls "$vardir") ; do timestamp="$(stat -c %Y $i)" echo "$i" echo "$timestamp" done
Result is similar no matter where I quote and I'm not sure what I'm doing wrong:
stat: cannot stat ‘Temporary’: No such file or directory Temporary stat: cannot stat ‘Items’: No such file or directory Items
My goal is I want to grab the timestamps off of backup directories and
touch the current ones to restore the original modified dates.