rsync list of files specified within a file

Question:
How to rsync files specified within a file

1. Make a back-up in case any problems arise so you can revert back to the start.

2. Ensure that the file permissions on the files directory give permission for the products image files to be deleted.

cd /var/www/html/drupal/shop/sites/default/
chown -Rv mreid.mreid files
chmod -Rv 777 files

3. Remove all existing products from the shop

This may be done via the Drupal admin interface. It is important that the process is allowed to succesfully delete (unlink) the associated product photos. Otherwise it will cause complications as the node will not have been fully removed.

4. Copy all required files from source to under files directory

a. From the excel spreadsheet 'copy and paste' all file names into /var/www/html/drupal/shop/sites/default/req-images file.

b. From directory '/var/www/html/drupal/shop/sites/default' enter the following:

rsync -av /var/www/html/tfi/www.tradefairinternational.com/acatalog/ --files-from 'req-images' root@guinness:/var/www/html/drupal/shop/sites/default/files/

c. Check to see which files (if any) have not been successfully copied - e.g. because the file does not exist. For these on the Excel spreadsheet update the 'Publish' filed to '0'. This will ensure the product is not published.

5. Make a CSV copy of the latest 'master-mirrors' Excel file.

Note this resides under: Public > Customers > French Mirror Company > mirror listings

Save the file as CSV (comma delimited).

6. Delete Unpublished rows from the CSV version so that no errors should occur during import.

7. Import the products using FireFox

Administer > Import content

- Select New Import
- click Next
- select Mirror content type, Next
- click Upload file and upload latest version of master-mirrors.csv, Next
- check all okay, Next
- Name : Title, Dimensions : Dimensions, Mirror ID : SEO ID, Alternative Ref : Alt Ref, Image : Image, Vocabularies : Catalogue, Description : Concatenated Description, SKU : SKU, Cost : Cost, Sell price : Sell price, Length : Length, Width : Width, Height : Height, Published : Published, Next

Multiple values are separated by: |

Input format: Full HTML
Comment settings: Disabled

Check all look okay then Next

Click Start import

Error: node import Referencing to the file used in the field

Note, I have commented out the following line in filefield_widget.inc (424 in the version I have):

Project: FileField
Error Message: node import Referencing to the file used in the field
See URL: http://drupal.org/node/441280 and http://drupal.org/node/466104

Workaround as follows:

$element['#title']))); ?>

The example below will copy the files as listed within req-images from source to destination.

Source: /var/www/html/tfi/www.tradefairinternational.com/acatalog/

Destination: root@guinness:/var/www/html/drupal/shop/sites/default/files/

rsync -av /var/www/html/tfi/www.tradefairinternational.com/acatalog/ --files-from 'req-images' root@guinness:/var/www/html/drupal/shop/sites/default/files/

Notes from man pages on Centos:

rsync [OPTION]... SRC [SRC]... DEST
rsync [OPTION]... SRC [SRC]... [USER@]HOST:DEST
rsync [OPTION]... SRC [SRC]... [USER@]HOST::DEST
rsync [OPTION]... SRC [SRC]... rsync://[USER@]HOST[:PORT]/DEST
rsync [OPTION]... SRC
rsync [OPTION]... [USER@]HOST:SRC [DEST]
rsync [OPTION]... [USER@]HOST::SRC [DEST]
rsync [OPTION]... rsync://[USER@]HOST[:PORT]/SRC [DEST]

--exclude=PATTERN exclude files matching PATTERN
--exclude-from=FILE read exclude patterns from FILE
--include=PATTERN donât exclude files matching PATTERN
--include-from=FILE read include patterns from FILE
--files-from=FILE read list of source-file names from FILE

Taxonomy: