Sync Files to Google Drive where based on lastaccesstime or lastmodifiedtime

What is the problem you are having with rclone?

I am trying to exclude files to sync which have not been accessed or modified for a period of time.
I can only find a filter based on the age of the file (max-age and min-age ) but not when the file was last modified or accessed.
Is there a different way of doing this?
Thanks

What is your rclone version (output from rclone version)

rclone v1.51.0-148-g2a62471e-beta

  • os/arch: windows/amd64
  • go version: go1.14.1

Which OS you are using and how many bits (eg Windows 7, 64 bit)

Windows Server 2016 Standard

Which cloud storage system are you using? (eg Google Drive)

Google Drive

The command you were trying to run (eg rclone copy /tmp remote:tmp)

A log from the command with the -vv flag (eg output from rclone -vv copy /tmp remote:tmp)

hello and welcome to the forum,

are you sure about that; it seems to be working for me?

what is your command?

for example, lets say there is a folder
image

and these commands

rclone copy C:\path\to\local\folder\a remote: --max-age=0d --dry-run -v 
2020/04/04 12:31:50 INFO  : There was nothing to transfer

rclone copy C:\path\to\local\folder\a remote: --max-age=1d --dry-run -v 
2020/04/04 12:30:35 NOTICE: aaa.txt: Not copying as --dry-run

rclone copy C:\path\to\local\folder\a remote: --max-age=2d --dry-run -v 
2020/04/04 12:30:54 NOTICE: aaa.txt: Not copying as --dry-run
2020/04/04 12:30:54 NOTICE: aa.txt: Not copying as --dry-run

rclone copy C:\path\to\local\folder\a remote: --max-age=3d --dry-run -v 
2020/04/04 12:31:15 NOTICE: a.txt: Not copying as --dry-run
2020/04/04 12:31:15 NOTICE: aa.txt: Not copying as --dry-run
2020/04/04 12:31:15 NOTICE: aaa.txt: Not copying as --dry-run

C:\data\rclone\scripts\rr\other\test>rclone copy C:\path\to\local\folder\a remote: --max-age=32d --dry-run -v 
2020/04/04 12:40:06 NOTICE: a.txt: Not copying as --dry-run
2020/04/04 12:40:06 NOTICE: aa.txt: Not copying as --dry-run
2020/04/04 12:40:06 NOTICE: aaaa.txt: Not copying as --dry-run
2020/04/04 12:40:06 NOTICE: aaa.txt: Not copying as --dry-run
1 Like

Using the last modified time is built in to rclone with --min-age and --max-age.

If you want to select on last accessed then you'll need to use a tool like find and make a list of the files one to a line then pass that into the --files-from option.

I'm not sure how to do the find step on windows though...

I'd probably just use the last modified time, as the last accessed time isn't very reliable (it can get reset by backups for instance).

1 Like

Ok, i guess i assumed it was creation time based on the filter description
--max-age - Don’t transfer any file older than this
This option controls the maximum age of files to transfer.
I will run some tests, thanks for the replies.

the best way is to create a test folder and use --dry-run

All times in rclone are modification times.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.