How to rename same file names in a folder for all folders in the source (Google Drive )

What is the problem you are having with rclone?

I want to rename same file names in a folder for all folders in the source (Google Drive). can you please take a look at my .bat script and let me know what is wrong with it?

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

rclone v1.68.0

yes

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)

@echo off
setlocal enabledelayedexpansion

rem Function to dedupe files in the specified folder
call :dedupe "remote:"

echo Dedupe process completed.
pause
exit /b

:dedupe
set "folder=%~1"
for /f "tokens=*" %%i in ('rclone lsd !folder!') do (
    echo Processing folder: %%i
    rclone dedupe --dedupe-mode=rename !folder!%%i
    rem Recursively call the function for subdirectories
    call :dedupe "!folder!%%i/"
)
exit /b

Please run 'rclone config redacted' and share the full output. If you get command not found, please make sure to update rclone.

[remote]
type = drive
client_id = XXX
client_secret = XXX
scope = drive
upload_cutoff = 128Mi
chunk_size = 128Mi
server_side_across_configs = true
token = XXX
team_drive =

[remote2]
type = drive
client_id = XXX
client_secret = XXX
scope = drive
upload_cutoff = 128Mi
chunk_size = 128Mi
server_side_across_configs = true
token = XXX
team_drive =
### Double check the config for sensitive info before posting publicly

A log from the command that you were trying to run with the -vv flag

Fatal error: unknown shorthand flag: '1' in -1
Error: unknown shorthand flag: '1' in -1
Usage:
  rclone lsd remote:path [flags]

Flags:
  -h, --help        help for lsd
  -R, --recursive   Recurse into the listing

Flags for filtering directory listings (flag group Filter):
      --delete-excluded                     Delete files on dest excluded from sync
      --exclude stringArray                 Exclude files matching pattern
      --exclude-from stringArray            Read file exclude patterns from file (use - to read from stdin)
      --exclude-if-present stringArray      Exclude directories if filename is present
      --files-from stringArray              Read list of source-file names from file (use - to read from stdin)
      --files-from-raw stringArray          Read list of source-file names from file without any processing of lines (use - to read from stdin)
  -f, --filter stringArray                  Add a file filtering rule
      --filter-from stringArray             Read file filtering patterns from a file (use - to read from stdin)
      --ignore-case                         Ignore case in filters (case insensitive)
      --include stringArray                 Include files matching pattern
      --include-from stringArray            Read file include patterns from file (use - to read from stdin)
      --max-age Duration                    Only transfer files younger than this in s or suffix ms|s|m|h|d|w|M|y (default off)
      --max-depth int                       If set limits the recursion depth to this (default -1)
      --max-size SizeSuffix                 Only transfer files smaller than this in KiB or suffix B|K|M|G|T|P (default off)
      --metadata-exclude stringArray        Exclude metadatas matching pattern
      --metadata-exclude-from stringArray   Read metadata exclude patterns from file (use - to read from stdin)
      --metadata-filter stringArray         Add a metadata filtering rule
      --metadata-filter-from stringArray    Read metadata filtering patterns from a file (use - to read from stdin)
      --metadata-include stringArray        Include metadatas matching pattern
      --metadata-include-from stringArray   Read metadata include patterns from file (use - to read from stdin)
      --min-age Duration                    Only transfer files older than this in s or suffix ms|s|m|h|d|w|M|y (default off)
      --min-size SizeSuffix                 Only transfer files bigger than this in KiB or suffix B|K|M|G|T|P (default off)

Flags for listing directories (flag group Listing):
      --default-time Time   Time to show if modtime is unknown for files and directories (default 2000-01-01T00:00:00Z)
      --fast-list           Use recursive list if available; uses more memory but fewer transactions

Use "rclone [command] --help" for more information about a command.
Use "rclone help flags" for to see the global flags.
Use "rclone help backends" for a list of supported services.

2024/09/24 14:47:22 CRITICAL: Fatal error: unknown shorthand flag: '1' in -1
Dedupe process completed.

lsd output includes date and sizes "-1". which are being used in the following commands.

see rclone lsd
"If you just want the directory names use rclone lsf --dirs-only ."

1 Like

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