Dynamic directory names

Hi guys.
I work with daily folders created by a cron script using:
$(date '-1 day' +%A-%Y-%m-%d)

The problem is that I can't make work the following
rclone copy $(date '-1 day' +%A-%Y-%m-%d) dest:/

Am I missing something? There is a way to upload directories with this kind of script?

Thanks in advance.

You need to put back tics on the command you want the shell to execute.

What's the format you want to use?

You mean this ones? -> `

What's the format you want to use?

The same that in the example: rclone copy $(date -d '-1 day' +%A-%Y-%m-%d) dest:/
(I forgot to add the -d in my first post)

I tried with the ` too, with no luck.

user@demo:/tmp/test$ rclone copy `$(date -d  '-1 day' +%A-%Y-%m-%d)` dest:/test/`$(date -d  '-1 day' +%A-%Y-%m-%d)`
Wednesday-2019-11-06: command not found  
Try 'date --help' for more information.

But for example if I run something like

$ mkdir $(date -d '-1 day' +%A-%Y-%m-%d)

It creates a directory called Wednesday-2019-11-06

I'm a little confused.

What OS are you using?

I'm using Ubuntu 18.04.

Copy requires a source and destination to work

So you need to rclone copy

What file / directory are you trying to copy?

You'd probably want to do something like:

rclone copy sourcedirectory destination:`date -d '-1 day' +%A-%Y-%m-%d`

So like

felix@gemini:~$ rclone copy /etc/hosts GD:`date -d '-1 day' +%A-%Y-%m-%d` -vv
2019/11/07 13:48:57 DEBUG : rclone: Version "v1.50.1" starting with parameters ["rclone" "copy" "/etc/hosts" "GD:Wednesday-2019-11-06" "-vv"]
2019/11/07 13:48:57 DEBUG : Using config file from "/opt/rclone/rclone.conf"
2019/11/07 13:48:57 DEBUG : hosts: Need to transfer - File not found at Destination
2019/11/07 13:48:59 DEBUG : hosts: MD5 = 574584fa3f744ea629b956464b687c40 OK
2019/11/07 13:48:59 INFO  : hosts: Copied (new)
2019/11/07 13:48:59 INFO  :
Transferred:   	       221 / 221 Bytes, 100%, 113 Bytes/s, ETA 0s
Errors:                 0
Checks:                 0 / 0, -
Transferred:            1 / 1, 100%
Elapsed time:        1.9s

2019/11/07 13:48:59 DEBUG : 5 go routines active
2019/11/07 13:48:59 DEBUG : rclone: Version "v1.50.1" finishing with parameters ["rclone" "copy" "/etc/hosts" "GD:Wednesday-2019-11-06" "-vv"]
felix@gemini:~$ rclone lsd GD:
          -1 2019-11-07 13:48:58        -1 Wednesday-2019-11-06
          -1 2019-09-29 21:57:58        -1 crypt

Oh great.
Now works with your solution. The fact is that should be great use the dynamic name in the source, because if the directory exists, give the same error. But this is useful too.

Thanks a lot @Animosity022!!!

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