I'm currently taking a class for Operating Systems and we're learning to do bash scripts as part of the curriculum. I need to append the date to all the files in a directory without touching sub-directories via a script. I've been to cobble up a one-liner script that will append the date to all the files, but it hits the folders in the current directory as well.
for f in *; do mv -- "$f" "$f-$(stat -c %Y "$f" | date +%Y%m%d)"; done
This'll append the date to the end of the filename, but like I said, it hits the directories under it. I'm currently using version 4.1.2 of bash on RedHatLinux.
I'm confused as all get out because of how inexeperienced with Unix I am (I'm primarily a Windows user), so any help would be appreciated.