Move Assets Scripts
Last Updated: 17 Dec 2015
This chapter describes the Squiz Matrix scripts that allow you to move and alter the location of assets within the system.
Bookmarks to the headings on this page:
move_assets.php
The move_assets.php script will move all assets of a single asset type from one specified folder to another.
This script is located in the /scripts directory of your Squiz Matrix system and takes the following parameters:
- The system root directory.
- The ID of the asset from which the assets will be moved.
- The ID of the asset under which the assets will be moved.
- The type code of the assets to move.
Example
$ php move_assets.php <system_root> 30 40 page_standard
Enter the root password for "The System": ******
moved 2 assets of type page_standard
Script has finished
move_assets_to_dated_folders.php
The move_assets_to_dated_folders.php script will move all assets of a single asset type into a dated folder structure.
The usage statement of this script is as follows:
move_assets_to_dated_folders <system_root> --root=[root node asset ID] --type=[asset type code] --field=[asset date field] --period=[time period] (--folder-link-type=[folder link type]) (--move-asset-status=[move asset status]) (--make-folders-live)
This script is located in the /scripts directory of your Squiz Matrix system and takes the following parameters:
- The system root directory.
- The ID of the asset from which the assets will be moved. The dated folder structure will be created or amended directly below this asset.
- The type code of the assets to move.
- The asset date field to be used to determine the destination folder for each asset. This can be created for the created date of the asset or published for the date that the asset went Live.
- A specification of the folder structure to be created. This can be year, month or day. If you enter month, the two-folder structure of year -> month will be used. If you enter day, the three-folder structure of year -> month -> day will be used.
- The link type for the dated folder structure. This can be either 1 or 2. This argument is optional. By default, all new folders will be created using TYPE_2 links.
- The Status that the assets must be in order for them to be moved. For example, if you enter 16, only the assets that are Live will be moved. For more information on the Status values available, refer to the Squiz Matrix Concepts chapter of the Concepts manual. This argument is optional.
- Enter --make-folders-live to set the Status of the folders to Live. This argument is optional. By default, it is set to Under Construction.
Example
The following example is moving all News Items from under asset #180 into Live year/month/day folders, determined by each asset’s creation date.
$ php move_assets_to_dated_folders.php <system_root> --root=180 --type=news_item --field=created --period=day --make-folders-live
Enter the root password for "The System": ******
- Moving asset #325...
- Creating Year Folder 2008... asset #400
- Creating Month Folder 05 under Year 2008... asset #401
- Creating Day Folder 20 under Year/Month 2008/05... asset #402
done
- Moving asset #326... done
- Moving asset #327... done
- Moving asset #328... done
- Moving asset #329... done
- Moving asset #330... done
- All done!