Is it possible to use a volume name with rclone on windows instead of a drive letter? And if so, how? Reading the documentation on rclone, I can only find examples for linux. But it seems it should be possible given that rclone is also able to mount volumes, so it is not ignorant of volume name.
Basically, instead of the following command (or the like) that I know works:
rclone sync C:\Path\To\Folder E:\Path\To\Folder
I would like to do something like this:
rclone sync VOLUMENAME:\Path\To\Folder VOLUMENAME:\Path\To\Folder
It would seem logically that this should be possible, given that rclone can mount drives. But any documentation pages I can find seem to relate to linux, like this one. I've tried reviewing documentation on the rclone site without finding anything.
Why would this be helpful? Let me give an example of one thing I am trying to do.
Example: I am using rclone in windows to keep several folders on various external drives in sync with a folder on a PC. I have a little script (batch file) to run in cmd to do this. It features commands like the following: rclone sync C:\Path\To\Folder E:\Path\To\Folder
where E is the drive letter of an external drive. Since I have several external drives to use and several folders, I have a number of these to get everything done. (Of course I have tested using --dry-run to make sure it goes good first).
My problem is that the drive letters of the external drives do not remain consistent. It seems that windows occasionally changes which get which letter. So in this case I need to carefully check the script to ensure all the drive letters are correct. I would much rather use the volume name so that the script can run without change each time. (Isn't that the point of using a script?)
I have tried to always get the drive letters the same by always plugging each external drive into the same port and plugging them in according to the same order. However, this is tricky to remember for me and of course there is the risk of human error (quite high for me).
I would hope there is a way in rclone to specify volume name instead of drive letter. Does anyone know of a method?
EDIT: I've edited the text above, since I apparently didn't explain the root of my question. Some have helpfully answered how to find out the drive letter for a volume name, in a way I can include in a batch file. Which would help solve my example. But it does not answer my root question, which is about rclone. So I rephrased above to make clearer my root question is specifically about rclone, and the batch file I have is one example. While making my batch file work is useful, it would be of longer term benefit for me to learn if this is possible with rclone itself. (Assume I didn't have a batch file and I am just typing the rclone command into cmd: is there a way to do this?)
@ECHO Off
SETLOCAL
:: %1 is the volume label required - in quotes if it contains separators.
SET "labelrequired=%~1"
SET "drive="
FOR %%e IN (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z) DO IF EXIST "%%e:\." (
FOR /f "tokens=5*delims= " %%b IN ('dir %%e:\^|find "Volume"') DO IF "%%b"=="is" IF /i "%%c"=="%labelrequired%" SET "drive=%%e"&GOTO found
)
:found
IF DEFINED drive ECHO Drive with LABEL "%~1" is %drive%:
IF NOT DEFINED drive ECHO Drive with LABEL "%~1" NOT found
GOTO :EOF
for each drive letter, if the drive exists, run a dir
command on the drive and filter-out the Volume
lines. The fifth token will contain "is" and the rest of the line the name of the volume.
Match that to the required name supplied, set drive
appropriately.
So
thisbatch seagate expansion drive
will search for a drive named seagate
thisbatch "seagate expansion drive"
will search for a drive named seagate expansion drive
(The /i
makes the match case-insensitive)