Command for move and delete existing files?


#1

I want to move(copy and if successful, delete source file) files from local(source) to remote(destination). If the file exist at remote(confirmed by hash etc), local file will be deleted.

What is the best command for this task?

This is the command that I use(with latest rclone beta)(tried with dry run)

rclone move --drive-use-trash -v --ignore-existing --no-traverse --no-update-modtime --dry-run “/home/Amazon Drive Downloads” mygmail:

Im not sure if this works but this is the logs

2017/07/07 00:08:27 INFO :
Transferred: 0 Bytes (0 Bytes/s)
Errors: 0
Checks: 0
Transferred: 5
Elapsed time: 4m0.4s

2017/07/07 00:09:27 INFO :
Transferred: 0 Bytes (0 Bytes/s)
Errors: 0
Checks: 0
Transferred: 5
Elapsed time: 5m0.4s

2017/07/07 00:10:27 INFO :
Transferred: 0 Bytes (0 Bytes/s)
Errors: 0
Checks: 0
Transferred: 5
Elapsed time: 6m0.4s

What is the best command for the task?

Thanks.


#2

rclone move is the right tool for that job and your command line looks OK.


#3

Turns out I have too many empty folders on my local drives. To fix it, I delete empty folders using this https://stackoverflow.com/questions/34018590/add-delete-empty-folders-to-windows-context-menu. Unfortunately, there are still some folders that are too long for the command line to process. For this I have to use manual work(search in windows explorer)

Works well after that.

Maybe if rclone implement an option to auto delete empty folders after move would be nice.

Thanks.


#4

Rclone has a command to do it separately.

Rclone rmdirs remote:


#5

You were right! I didnt know that!

Thanks!


#6

I havent tried it but does the command rmdirs can be use on local directory?

Im moving local files to cloud. Rclone left lots of empty folder on local drive. can rclone rmdirs useable on local drive?

Thanks.


#7

Sure. It should work… Or you could just use “find” though if you’re on Linux:

find . -type d -empty -delete


#8

The command is Ok, if problem still persist try LongPathTool program.


#9

Can I ask how can we turn this to false so when we move files we can just get the files deleted at the source permanently than send them to trash?


#10

Just use --drive-use-trash=false


#11

If you are still persisting same problem, you can try Long Path Tool program for fast and efficient moving and deleting long files