Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Atalantia

macrumors newbie
Original poster
Dec 30, 2012
18
7
Germany
I remember a long time ago, I could tell Safari to make a folder for every day of download. This disappeared a long time ago until now..! I was tired the pile up in the download folder and because I cant decide always, do I want to delete or move this download, I wanted them to be sorted by forlders. So when I go through I have a landmark.
I made a script that is triggered every day by launchd, that will do the job.
Be aware of the download path you have. "fDir=" maybe different on your configuration:
Code:
#!/bin/bash

    # Script-Name    : BrowserDlbyDate
    # Version        : 1.4
    # Autor            : Atalantia
    # Datum            : 2021.05.07
    # Lizenz        : GPLv3

#mDate=$(date -j -v-1d +"%s")                                #Epochal date - 1 day
eDate=$(date +%s)                                            #Epochal date
cDate=$(date +%Y-%m-%d)                                        #Current date
fDir=~/Downloads/

for x in ${fDir}*;do
    if [[ $(basename "$x") =~ ^[0-9-]+$ ]]; then :
    elif [ $[$eDate - $(date -r "$x" "+%s")] -gt 172800 ];then
        mkdir -p "$fDir$cDate" && mv "$x" "$fDir$cDate"
    fi
done
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.