Google: Any way to list directories older than 30 days?

Hi,

Any way to filter directories by directory age? For example, I want to list directories older than 30 days

rclone --min-age 30d lsd gsuite:/

This command seems to list all the directories. I suspect it’s only filtering the files, which is moot since I use lsd.

My eventual goal is to move all directories older than 30 days into an “Archive” folder, all on Google. I don’t care about how old the files are, I just want to look at the age of the dir. Any help achieving that goal is appreciated.

Yes you are right - rclone only filters on file ages.

Rclone makes some attempt to return directory ages but it isn’t that reliable among cloud storage providers…

I’d probably do this by naming the directories YYYY_MM_DD then use a bit of shell script to find when you have more than 30. rclone lsf is ideal for this kind of scripting…

So something like find the oldest directories more than 30

rclone lsf --dirs-only . | egrep '^[0-9]{4}-[0-9]{2}-[0-9]{2}' | sort -r | awk 'NR > 30'

you can then take this list and use rclone moveto to move them an Archive folder.

thanks. Unfortunately, the directories are named by an automated Google process, so I have no control of them. I wrote a python script to parse the lad listing, and I’ll use that data.

1 Like