0

When mv is used between different storages, it first copies all files and then unlinks the source. How to mv files one by one, so that each file is unlinked after being copied, and the folder structure is preserved?

  • What do you mean one by one? If you run mv file* target/, that will already move each file one by one. Can you give a specific example with an example directory/file structure so we can understand what you need? – terdon Jul 4 at 11:58
  • I need to move files from one FUSE mount to another, but both are located on the same physical drive that has no space for a full temporary copy. – Barafu Albino Jul 5 at 5:24
1

You could use rsync for this.

rsync -r --remove-source-files source_dir dest_dir

Files are immediately removed once transferred. Depending on which other information you need to preserve, you might actually prefer --archive (-a) over simple recursiveness (-r).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.