(Tips) How to copy images partially from a live Drupal site to a development/test site
Tips : How to copy images partially from a live Drupal site to a development/test site
Copying a Drupal site from a live server to a test one is normally a straightforward process: you dump the database, and create a tar archive of the site, extract the archive, load the database dump, make a few changes to the settings.php file, and voila: you have a test site that mirrors the live site. You can then use this for development, training or any other purpose.
We recently need to do this to a a live site, but it had way too much images: with 5.6 GB's worth of images, making an exact copy on a smaller server was not an option. So, we devised the following method to copy images only from the last 7 days, to make the test site more manageable, yet reflecting what the live site has very closely.
This assumes that the images are either attachments using the core upload module, or the image module. Doing this with imagecache, and CCK requires a bit more SQL.
We login to the live site, and change to the directory where Drupal is:
cd /var/www/live.siteWe create a database dump as usual:
mysqldump -uuser -p dbname > yoursite.sqlWe create a tar archive, excluding the files directory:
tar --exclude="files" -czvf yoursite.tar.gz .Then, we find out what theUNIX epoch date now
date +%s
Courtesy : 2bits.com
- guru's blog
- Login to post comments
![Drupal-6-Book-[Building Powerful and Robust Websites with Drupal 6].jpg](http://www.drupalranch.com/images/Drupal-6-Book-[Building%20Powerful%20and%20Robust%20Websites%20with%20Drupal%206].jpg)