For each filedot string, split on the dot (.) character. The last segment is the filename; all preceding segments are folders.
Example: "HR.Policies.remote_work.pdf" → ["HR", "Policies", "remote_work.pdf"] filedot to folder top
#!/bin/bash
# This script moves recent files to the folder top (Filedot to Folder Top)
for file in *; do
if [ -f "$file" ]; then
# Add exclamation to the start of the filename
mv "$file" "!_$file"
fi
done
On Unix/Linux systems, a file starting with a dot (e.g., .hidden_note.txt) is a system file. It will be invisible by default. Do not use a literal dot (period) for "Filedot to Folder Top" unless you have enabled "Show Hidden Files." For each filedot string, split on the dot (