Regex help with finding files/folders with year in name

What is the problem you are having with rclone?

Trying to list all folders/files using regex that contain a specfic year in them. Ex 1950-1960. Basically was going to do some cleanup on older movies. I like to list everything out and see the results before running the purge/delete option.

Run the command 'rclone version' and share the full output of the command.

rclone v1.60.0-beta.6373.2f461f13e
os/version: Microsoft Windows 10 Pro 21H2 (64 bit)
os/kernel: 10.0.19044.1826 (x86_64)
os/type: windows
os/arch: amd64
go/version: go1.18.4
go/linking: static
go/tags: cmount

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)

rclone -v --include "{{(19[56]\d)}}" ls "gdrive:\Plex Cloud Sync\Movies"
rclone ls "gdrive:\Plex Cloud Sync\Movies" --filter "{{(19[56]\d)}}" 

The rclone config contents with secrets removed.

[gdrive]
type = drive

A log from the command with the -vv flag

PS C:\Users\username> rclone ls "gdrive:\Plex Cloud Sync\Movies" --filter "{{(19[56]\d)}}"     
2022/07/26 13:32:30 Failed to load filters: malformed rule "{{(19[56]\\d)}}"
PS C:\Users\username> rclone -vv --include "{{(19[56]\d)}}" lsl "gdrive:\Plex Cloud Sync\Movies"
2022/07/26 13:34:34 DEBUG : rclone: Version "v1.60.0-beta.6373.2f461f13e" starting with parameters ["C:\\rclone\\rclone.exe" "-vv" "--include" "{{(19[56]\\d)}}" "lsl" "gdrive:\\Plex Cloud Sync\\Movies"]
2022/07/26 13:34:34 DEBUG : Creating backend with remote "gdrive:\\Plex Cloud Sync\\Movies"
2022/07/26 13:34:34 DEBUG : Using config file from "C:\\Users\\username\\.rclone.conf"      
2022/07/26 13:34:34 DEBUG : fs cache: renaming cache item "gdrive:\\Plex Cloud Sync\\Movies" to be canonical "gdrive:Plex Cloud Sync/Movies"
Then it just list all my movies. 

Second command outputs this when I try to use the filter option
2022/07/26 13:37:08 Failed to load filters: malformed rule "{{(19[56]\\d)}}"

might try --include="{{(19[56]\d)}}"

The problem here is that it is expecting the whole file name to be a date as it matches the start and the end.

What you want is

--include '*{{19[56]\d}}*'
1 Like

This worked. I didn't think about trying it with the wildcards on both sides. Thank you!

1 Like

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