need to copy file form one path A to another path B and then want to delete the original file form path A .with Linux script

  • 2
    Is copying a necessity? Moving mv does what you describe, but on the same partition that just means rewriting the pointers, for cross-partition moves, it behaves exactly as you describe: 1) copy file 2) delete original. (you can see this when using the -v option for more verbosity) – FelixJN Nov 11 '19 at 8:30
  • Is there some particular restriction or requirement that you're unsure of how to achieve? Otherwise, mv pathA pathB seems to do what you ask for, assuming pathA is the pathname of the original file and pathB is the pathname that you want to move the file to, or of a destination directory. – Kusalananda Nov 11 '19 at 8:35

try using rsync:

rsync --dry-run -v --remove-source-files /path/A/fileA /path/B/

--dry-run is used for dry run.

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.