Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mv equivalent rsync command [closed]

Tags:

i'm trying to move folders to another folders using command line, with overwrite if already exists, but i got error "Is a directory" when using mv..

example:

mv src/test/ dest/ 

there are many files and folders on src/test/, there are also some files and some folders on dest/

and i want files and folders on dest/ replaced with files and folder from src/test/ if exists, example:

src/test/bla/boo replaces dest/bla/boo src/test/bla/bla/boo replaces dest/bla/bla/boo 

also, everytime one file transfer completed, that one file deleted from src/test/

and overall transfer progress bar would be fine..

what rsync flag should i use to make this happend?

like image 650
Kokizzu Avatar asked Mar 24 '12 07:03

Kokizzu


People also ask

Which is faster mv or rsync?

If your filesystem is copy-on-write, then copy ( cp or rsync , for instance) should be comparable to a move. But for most common cases, move ( mv ) will be the fastest, since it can simply switch around the pieces of data that describe where a file is placed (note: this is overly simplified).

Does rsync move or copy?

Rsync, which stands for remote sync, is a remote and local file synchronization tool. It uses an algorithm to minimize the amount of data copied by only moving the portions of files that have changed.

What is difference between scp and rsync?

Copying files and directories with SCP or Rsync Secure Copy (SCP) uses SSH to copy only the files or directories that you select. On first use, Rsync copies all files and directories and then it copies only the files and directories that you have changed. It does not copy all the files and directories again.

Is cp faster than rsync?

rsync is much faster than cp for this, because it will check file sizes and timestamps to see which ones need to be updated, and you can add more refinements. You can even make it do a checksum instead of the default 'quick check', although this will take longer.


1 Answers

The following command line should achieve what you want:

$ rsync -a --progress --remove-source-files src/test/ dest 
like image 141
Frédéric Hamidi Avatar answered Nov 08 '22 10:11

Frédéric Hamidi