"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

Accepted Solution

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

Expert Comment

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

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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.
Watch the video of Kernel Migrator for SharePoint, which demonstrate the process easily of migration from SharePoint to SharePoint, OneDrive for Business & Google Drive servers, Public Folder to SharePoint, File Server to SharePoint. The tool has va…

623 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