Skip to content

Google drive folder named single quote can't be listed #3262

Closed

Description

@Akira657

What is the problem you are having with rclone?

Remote Google folder named single quote can't be listed.

What is your rclone version (output from rclone version)

1.47

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

linux 64 bit

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 lsf --format pi "remote:'"

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

2019/06/14 17:09:19 ERROR : : error listing: directory not found
2019/06/14 17:09:19 Failed to lsf: error in ListJSON: directory not found

Activity

  1. added this to the Known Problem milestone on Jun 14, 2019
  2. ncw commented on Jun 14, 2019

    @ncw
    Member

    This is probably to do with this code if you fancy investigating.

    https://github.com/ncw/rclone/blob/22368b997c093bc51c6305fab120f07b7dea7daf/backend/drive/drive.go#L602

    The escaping for search terms isn't documented (or wasn't when we wrote the code)

    https://developers.google.com/drive/api/v3/search-files

    I think rclone is doing the right thing

    The first query is this when looking for a file

    q=trashed=false and ('root' in parents) and (name='\'') and mimeType!='application/vnd.google-apps.folder'
    

    And the second query is this when looking for a directory

    q=trashed=false and ('root' in parents) and (name='\'') and mimeType='application/vnd.google-apps.folder'
    

    Which look correct for looking for a directory called ' in the root.

    So this could well be a bug in google drive rather than rclone.

    @B4dM4n any ideas?

    $ rclone lsf "TestDrive:'" -vv --dump bodies
    2019/06/14 10:54:37 DEBUG : rclone: Version "v1.47.0-127-g09893fa8-fix-3210-b2-copy-beta" starting with parameters ["rclone" "lsf" "TestDrive:'" "-vv" "--dump" "bodies"]
    2019/06/14 10:54:37 DEBUG : Using config file from "/home/ncw/.rclone.conf"
    2019/06/14 10:54:37 DEBUG : >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    2019/06/14 10:54:37 DEBUG : HTTP REQUEST (req 0xc00011a500)
    2019/06/14 10:54:37 DEBUG : GET /drive/v3/files?alt=json&fields=files%28id%2Cname%2Csize%2Cmd5Checksum%2Ctrashed%2CmodifiedTime%2CcreatedTime%2CmimeType%2Cparents%2CwebViewLink%29%2CnextPageToken&pageSize=1000&prettyPrint=false&q=trashed%3Dfalse+and+%28%27root%27+in+parents%29+and+%28name%3D%27%5C%27%27%29+and+mimeType%3D%27application%2Fvnd.google-apps.folder%27 HTTP/1.1
    Host: www.googleapis.com
    User-Agent: rclone/v1.47.0-127-g09893fa8-fix-3210-b2-copy-beta
    Authorization: XXXX
    Accept-Encoding: gzip
    
    2019/06/14 10:54:37 DEBUG : >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    2019/06/14 10:54:37 DEBUG : <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    2019/06/14 10:54:37 DEBUG : HTTP RESPONSE (req 0xc00011a500)
    2019/06/14 10:54:37 DEBUG : HTTP/1.1 200 OK
    Transfer-Encoding: chunked
    Alt-Svc: quic=":443"; ma=2592000; v="46,44,43,39"
    Cache-Control: private, max-age=0, must-revalidate, no-transform
    Content-Type: application/json; charset=UTF-8
    Date: Fri, 14 Jun 2019 09:54:37 GMT
    Expires: Fri, 14 Jun 2019 09:54:37 GMT
    Server: GSE
    Vary: Origin
    Vary: X-Origin
    X-Content-Type-Options: nosniff
    X-Frame-Options: SAMEORIGIN
    X-Xss-Protection: 1; mode=block
    
    c
    {"files":[]}
    0
    
    2019/06/14 10:54:37 DEBUG : <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    2019/06/14 10:54:37 DEBUG : >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    2019/06/14 10:54:37 DEBUG : HTTP REQUEST (req 0xc0004dca00)
    2019/06/14 10:54:37 DEBUG : GET /drive/v3/files?alt=json&fields=files%28id%2Cname%2Csize%2Cmd5Checksum%2Ctrashed%2CmodifiedTime%2CcreatedTime%2CmimeType%2Cparents%2CwebViewLink%29%2CnextPageToken&pageSize=1000&prettyPrint=false&q=trashed%3Dfalse+and+%28%27root%27+in+parents%29+and+%28name%3D%27%5C%27%27%29+and+mimeType%21%3D%27application%2Fvnd.google-apps.folder%27 HTTP/1.1
    Host: www.googleapis.com
    User-Agent: rclone/v1.47.0-127-g09893fa8-fix-3210-b2-copy-beta
    Authorization: XXXX
    Accept-Encoding: gzip
    
    2019/06/14 10:54:37 DEBUG : >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    2019/06/14 10:54:38 DEBUG : <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    2019/06/14 10:54:38 DEBUG : HTTP RESPONSE (req 0xc0004dca00)
    2019/06/14 10:54:38 DEBUG : HTTP/1.1 200 OK
    Transfer-Encoding: chunked
    Alt-Svc: quic=":443"; ma=2592000; v="46,44,43,39"
    Cache-Control: private, max-age=0, must-revalidate, no-transform
    Content-Type: application/json; charset=UTF-8
    Date: Fri, 14 Jun 2019 09:54:38 GMT
    Expires: Fri, 14 Jun 2019 09:54:38 GMT
    Server: GSE
    Vary: Origin
    Vary: X-Origin
    X-Content-Type-Options: nosniff
    X-Frame-Options: SAMEORIGIN
    X-Xss-Protection: 1; mode=block
    
    c
    {"files":[]}
    0
    
    2019/06/14 10:54:38 DEBUG : <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    2019/06/14 10:54:38 DEBUG : >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    2019/06/14 10:54:38 DEBUG : HTTP REQUEST (req 0xc00011a200)
    2019/06/14 10:54:38 DEBUG : GET /drive/v3/files?alt=json&fields=files%28id%2Cname%2Csize%2Cmd5Checksum%2Ctrashed%2CmodifiedTime%2CcreatedTime%2CmimeType%2Cparents%2CwebViewLink%29%2CnextPageToken&pageSize=1000&prettyPrint=false&q=trashed%3Dfalse+and+%28%27root%27+in+parents%29+and+%28name%3D%27%5C%27%27%29+and+mimeType%3D%27application%2Fvnd.google-apps.folder%27 HTTP/1.1
    Host: www.googleapis.com
    User-Agent: rclone/v1.47.0-127-g09893fa8-fix-3210-b2-copy-beta
    Authorization: XXXX
    Accept-Encoding: gzip
    
    2019/06/14 10:54:38 DEBUG : >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    2019/06/14 10:54:38 DEBUG : <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    2019/06/14 10:54:38 DEBUG : HTTP RESPONSE (req 0xc00011a200)
    2019/06/14 10:54:38 DEBUG : HTTP/1.1 200 OK
    Transfer-Encoding: chunked
    Alt-Svc: quic=":443"; ma=2592000; v="46,44,43,39"
    Cache-Control: private, max-age=0, must-revalidate, no-transform
    Content-Type: application/json; charset=UTF-8
    Date: Fri, 14 Jun 2019 09:54:38 GMT
    Expires: Fri, 14 Jun 2019 09:54:38 GMT
    Server: GSE
    Vary: Origin
    Vary: X-Origin
    X-Content-Type-Options: nosniff
    X-Frame-Options: SAMEORIGIN
    X-Xss-Protection: 1; mode=block
    
    c
    {"files":[]}
    0
    
    2019/06/14 10:54:38 DEBUG : <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    2019/06/14 10:54:38 ERROR : : error listing: directory not found
    2019/06/14 10:54:38 Failed to lsf with 2 errors: last error was: error in ListJSON: directory not found
    
  3. animosity022 commented on May 20, 2020

    @animosity022
    Contributor

    Is this still an issue?

    felix@gemini:~$ rclone lsd GD:
              -1 2020-05-20 19:04:15        -1 'Testing
              -1 2019-09-29 21:57:58        -1 crypt
              -1 2020-03-10 05:20:13        -1 test
    felix@gemini:~$ rclone ls GD:"'Testing"
    952107008 ubuntu-20.04-live-server-amd64.iso
    felix@gemini:~$
    

    Or am I misunderstanding what the problem was?

  4. calisro commented on May 20, 2020

    @calisro
    Member

    Screenshot_20200520-191150
    Still an issue

  5. animosity022 commented on May 20, 2020

    @animosity022
    Contributor

    Ah, I see what I misread now. Thanks.

  6. ncw commented on May 25, 2020

    @ncw
    Member

    I'm pretty sure this is a bug in google drive and its handling of the name parameter. Rclone is doing the escaping the same for all of these:

    Folder Works
    ' No
    '' No
    'a' No
    'a Yes
    a' Yes

    We maybe should stop searching for specific names and list the entire directory. This would be less efficient though.

    An alternative would be to not search for specific names if they had ' or \ in - that would be a pretty easy work-around.

  7. Cprakhar commented on Feb 15, 2026

    @Cprakhar
    Contributor

    I guess it is fixed.

    $ rclone lsf --format pi "TestDrive:'" -vv
    2026/02/15 22:51:52 DEBUG : rclone: Version "v1.73.0" starting with parameters ["rclone" "lsf" "--format" "pi" "TestDrive:'" "-vv"]
    2026/02/15 22:51:52 DEBUG : Creating backend with remote "TestDrive:'"
    2026/02/15 22:51:52 DEBUG : Using config file from "/home/ghostblasius/.config/rclone/rclone.conf"
    folder1/;1_wf-pxITJf9Pdr-FdsUJpZd70BKExHq9
    folder2/;1-pB-hTgrPrbrJMmp_cIdZ5rV7phDM2dY
    2026/02/15 22:51:54 DEBUG : 6 go routines active
    
    $ rclone lsf "TestDrive:'" -vv --dump-bodies
    2026/02/15 23:36:43 NOTICE: --dump-bodies is obsolete - please use --dump bodies instead
    2026/02/15 23:36:43 DEBUG : rclone: Version "v1.73.0" starting with parameters ["rclone" "lsf" "TestDrive:'" "-vv" "--dump-bodies"]
    2026/02/15 23:36:43 DEBUG : Creating backend with remote "TestDrive:'"
    2026/02/15 23:36:43 DEBUG : Using config file from "/home/ghostblasius/.config/rclone/rclone.conf"
    2026/02/15 23:36:43 DEBUG : You have specified to dump information. Please be noted that the Accept-Encoding as shown may not be correct in the request and the response may not show Content-Encoding if the go standard libraries auto gzip encoding was in effect. In this case the body of the request will be gunzipped before showing it.
    2026/02/15 23:36:43 DEBUG : >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    2026/02/15 23:36:43 DEBUG : HTTP REQUEST (req 0xc000370c80)
    2026/02/15 23:36:43 DEBUG : GET /drive/v3/files?alt=json&fields=files%28id%2Cname%2Csize%2Cmd5Checksum%2Csha1Checksum%2Csha256Checksum%2Ctrashed%2CexplicitlyTrashed%2CmodifiedTime%2CcreatedTime%2CmimeType%2Cparents%2CwebViewLink%2CshortcutDetails%2CexportLinks%2CresourceKey%29%2CnextPageToken%2CincompleteSearch&includeItemsFromAllDrives=true&pageSize=1000&prettyPrint=false&q=trashed%3Dfalse+and+%28%270AK_yzUVp7hchUk9PVA%27+in+parents%29+and+%28name%3D%27%5C%27%27%29+and+%28mimeType%3D%27application%2Fvnd.google-apps.folder%27+or+mimeType%3D%27application%2Fvnd.google-apps.shortcut%27%29&supportsAllDrives=true HTTP/1.1
    Host: www.googleapis.com
    User-Agent: rclone/v1.73.0
    Authorization: XXXX
    X-Goog-Api-Client: gl-go/1.25.6- X:nodwarf5 gdcl/0.255.0
    Accept-Encoding: gzip
    
    2026/02/15 23:36:43 DEBUG : >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    2026/02/15 23:36:44 DEBUG : <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    2026/02/15 23:36:44 DEBUG : HTTP RESPONSE (req 0xc000370c80)
    2026/02/15 23:36:44 DEBUG : HTTP/1.1 200 OK
    Transfer-Encoding: chunked
    Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000
    Cache-Control: no-cache, no-store, max-age=0, must-revalidate
    Content-Type: application/json; charset=UTF-8
    Date: Sun, 15 Feb 2026 18:06:44 GMT
    Expires: Mon, 01 Jan 1990 00:00:00 GMT
    Pragma: no-cache
    Server: ESF
    Vary: Origin, X-Origin
    X-Content-Type-Options: nosniff
    X-Frame-Options: SAMEORIGIN
    X-Xss-Protection: 0
    
    182
    {"files":[{"parents":["0AK_yzUVp7hchUk9PVA"],"id":"1HA-2RmdETuZayfMzpNCvCV3BQnjtTe9n","name":"'","mimeType":"application/vnd.google-apps.folder","trashed":false,"explicitlyTrashed":false,"webViewLink":"https://drive.google.com/drive/folders/1HA-2RmdETuZayfMzpNCvCV3BQnjtTe9n","createdTime":"2026-02-15T18:05:15.963Z","modifiedTime":"2026-02-15T18:05:15.963Z"}],"incompleteSearch":false}
    0
    
    2026/02/15 23:36:44 DEBUG : <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    2026/02/15 23:36:44 DEBUG : >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    2026/02/15 23:36:44 DEBUG : HTTP REQUEST (req 0xc000c20a00)
    2026/02/15 23:36:44 DEBUG : GET /drive/v3/files?alt=json&fields=files%28id%2Cname%2Csize%2Cmd5Checksum%2Csha1Checksum%2Csha256Checksum%2Ctrashed%2CexplicitlyTrashed%2CmodifiedTime%2CcreatedTime%2CmimeType%2Cparents%2CwebViewLink%2CshortcutDetails%2CexportLinks%2CresourceKey%29%2CnextPageToken%2CincompleteSearch&includeItemsFromAllDrives=true&pageSize=1000&prettyPrint=false&q=trashed%3Dfalse+and+%28%271HA-2RmdETuZayfMzpNCvCV3BQnjtTe9n%27+in+parents%29&supportsAllDrives=true HTTP/1.1
    Host: www.googleapis.com
    User-Agent: rclone/v1.73.0
    Authorization: XXXX
    X-Goog-Api-Client: gl-go/1.25.6- X:nodwarf5 gdcl/0.255.0
    Accept-Encoding: gzip
    
    2026/02/15 23:36:44 DEBUG : >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    2026/02/15 23:36:44 DEBUG : <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    2026/02/15 23:36:44 DEBUG : HTTP RESPONSE (req 0xc000c20a00)
    2026/02/15 23:36:44 DEBUG : HTTP/1.1 200 OK
    Transfer-Encoding: chunked
    Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000
    Cache-Control: no-cache, no-store, max-age=0, must-revalidate
    Content-Type: application/json; charset=UTF-8
    Date: Sun, 15 Feb 2026 18:06:44 GMT
    Expires: Mon, 01 Jan 1990 00:00:00 GMT
    Pragma: no-cache
    Server: ESF
    Vary: Origin, X-Origin
    X-Content-Type-Options: nosniff
    X-Frame-Options: SAMEORIGIN
    X-Xss-Protection: 0
    
    308
    {"files":[{"parents":["1HA-2RmdETuZayfMzpNCvCV3BQnjtTe9n"],"id":"1jLTXCOhgCDBlbTxHPzpTJwTy9aYyXgjh","name":"folder2","mimeType":"application/vnd.google-apps.folder","trashed":false,"explicitlyTrashed":false,"webViewLink":"https://drive.google.com/drive/folders/1jLTXCOhgCDBlbTxHPzpTJwTy9aYyXgjh","createdTime":"2026-02-15T18:06:38.196Z","modifiedTime":"2026-02-15T18:06:38.196Z"},{"parents":["1HA-2RmdETuZayfMzpNCvCV3BQnjtTe9n"],"id":"12rqD7DjziDkjzEk6zH6YvmDR6rNPJ76R","name":"folder1","mimeType":"application/vnd.google-apps.folder","trashed":false,"explicitlyTrashed":false,"webViewLink":"https://drive.google.com/drive/folders/12rqD7DjziDkjzEk6zH6YvmDR6rNPJ76R","createdTime":"2026-02-15T18:05:27.362Z","modifiedTime":"2026-02-15T18:05:27.362Z"}],"incompleteSearch":false}
    0
    
    2026/02/15 23:36:44 DEBUG : <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    folder1/
    folder2/
    2026/02/15 23:36:44 DEBUG : 6 go routines active
    
  8. ncw commented on Oct 15, 2026

    @ncw
    Member

    This works in current rclone and there is now an integration test for folder names containing single quotes. Closing, but please reopen if you can still reproduce it with the latest beta.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions