How to extract file names after move command is successfully done?

What is the problem you are having with rclone?

Move command works like a charm, but I want to extract the files name after transferring is done.
After the transferring I have got to save the file's name, size, path, created date in RDBMS and do something more jobs which relevant to file name and path.

I have tried -P flag or -v and it worked but it wasn't exactly I wanted to get and it was too verbose.
I can slice and extract the --progress results but it seems so error-prone.

I am running command in Java and want to grab the transferred files name and add in to List.

I am gonna run it regularly as a batch job so the file name could be arbitrary.


2022-10-27 14:29:18 INFO  : test5.txt: Copied (new)
Transferred:   	          0 B / 0 B, -, 0 B/s, ETA -
Checks:                 0 / 1, 0%
Transferred:            0 / 1, 0%
Elapsed time:         0.2s

 *                                     test5.txt:  0% /0, 0/s, -
2022-10-27 14:29:18 INFO  : test5.txt: Deleted
Transferred:   	          0 B / 0 B, -, 0 B/s, ETA -
Checks:                 0 / 1, 0%
Deleted:                1 (files), 0 (dirs)
Transferred:            1 / 1, 100%
Elapsed time:         0.3s
 *                                     test5.txt: checkingTransferred:   	          0 B / 0 B, -, 0 B/s, ETA -
Checks:                 2 / 2, 100%
Deleted:                1 (files), 0 (dirs)
Renamed:                1
Transferred:            1 / 1, 100%
Elapsed time:         0.3s

expected (only when it is transferred successfully)


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

rclone v1.60.0
- os/version: darwin 11.7 (64 bit)
- os/kernel: 20.6.0 (arm64)
- os/type: darwin
- os/arch: arm64
- go/version: go1.19.2
- go/linking: dynamic
- go/tags: cmount

Which cloud storage system are you using? (eg Google Drive)

SFTP, Linux(remote) / Mac(local)

The command you were trying to run (eg rclone copy /tmp remote:tmp)

rclone move name:path path -vP

The rclone config contents with secrets removed.

Paste config here

A log from the command with the -vv flag

Paste  log here

Thanks for your generous help!

Rclone can't output just the transferred files at the moment, though that feature has been requested before.

I would try using -v --use-json-log without -P

This will give you parsable logs with not too much extra stuff.

Hi 강재 최,

You could also do something like this:

rclone move name:path path -v --log-file=logfile
cat logfile | sed -E 's/^([-\/<>: 0-9]+INFO  : (.*): (Copied|Moved) \(.+\).*|.*)$/\2/; /^$/d'

or make a one liner:

rclone move name:path path -v 2>&1 | sed -E 's/^([-\/<>: 0-9]+INFO  : (.*): (Copied|Moved) \(.+\).*|.*)$/\2/; /^$/d'

Thanks for your answer. I will give it a shot!
I guess this feature is not in demand so might be that is the best practice for now :smiley:

Thanks for your specific implementation. It might be very workable, I haven't tried yet :slight_smile:

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