Copying Files & Preserving the Timestamp

To copy a file from one location to another in Linux you would use the following command:
> cp SOURCE DESTINATION
To copy all files in a folder you would use:
> cp * /DESTINATION_FOLDER
To copy all files and sub-folders:
> cp -r * /DESTINATION_FOLDER
To copy all files & sub-folders while preserving the file timestamps:
> cp -rp * /DESTINATION_FOLDER
To copy all files & sub-folders while preserving the file timestamps and forcing overwrite:
> cp -frp * /DESTINATION_FOLDER
And if the above forcing does not work in your environment, it is possible that you have an alias preventing the FORCE command from working. 
Run the "alias" command to see if you have an alias for the cp command - it would look something links this:
> alias
cp -i
To remove the alias (temporarily for the current session) you would run:
> unalias cp
Vioala!

  • 6 Users Found This Useful
Was this answer helpful?

Related Articles

Cannot Un-install Frontpage Extensions in cPanel

If you are attempting to Un-install the Frontpage Extensions in a cPanel environment and the...

How to Change the "Great Success" Default Apache Welcome Page

How do i get rid of the page that says Great Success ! Apache is working on your cPanel® and...

Creating a Backup using the TAR Command

One of the most common commands you will discover when dealing with a hosting server is the TAR...

Installing Wildcard SSL in WHM / CPANEL

This article is intended for Web Site Administrators with full control of a dedicated server,...

Watching LESS files for changes over SSHFS

Using SSFS to mounts drives into a development environment is a great way to streamline...

Disqus this...

comments powered by Disqus