Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


"mv" vs. "cp"

Posted on 1999-07-09
Medium Priority
Last Modified: 2013-12-26
I'm modifying a production script thinking of replacing a command with "mv".  The original command was to do a "cp" of a file, then run "cmp" and "cksum" to ensure the two copies are the same then do a "rm" of the original file.  Due to the new requirement I would like to retain the original timestamp of the file and I could only think of using the "mv" command instead.

Should I be worry about by-passing all the parity checking??

Does "mv" also doing a "cp"+"delete" in the background or does it only move the soft-pointer of the file??

If I don't use the "mv" command, are there any other ways to
relocate a file but retaining its timestamp??

Please advise....Thanks.
Question by:mindless
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Accepted Solution

helver earned 800 total points
ID: 1297989
using "cp -p" should maintain the file permissions, and timestamps.
LVL 84

Expert Comment

ID: 1297990
Is the target on the same file system as the source?

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…

661 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question