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!

  • 3 Users Found This Useful
Was this answer helpful?

Related Articles

Clearing MaxEmails email sending block in WHM

If an account within your hosting server gets blocked due to exceeding the Maximum Emails per...

Updating IonCube Loader in Linux Fedora

Ioncube is a popular solution for encoding /encrypting PHP script before distribution.  Most web...

Fedora Monitor Display Issues

How to reset your monitor settings in Fedora 10: Boot Machine Press CTRL+ALT+F3 to get to...

Backup & Restore MySQL Database Tables

To backup and restore a MySQL database with all tables from a command prompt: To Backup the...

Disqus this...

comments powered by Disqus