Answers:
你可以用drush来做:
$ drush help ne-export
Export nodes using Node export.
Arguments:
nids : A list of space-separated node IDs to export.
Options:
--file : The filename of the output file. If supplied, the node code will be
exported to that file, otherwise it will export to stdout.
--format : If supplied, node code will be output using a particular export
format, if available. (e.g. serialize)
--status : Filter for 'status'; A boolean value (0 or 1) indicating whether
the node is published (visible to non-administrators).
--promote : Filter for 'promote'; A boolean value (0 or 1) indicating whether
the node should be displayed on the front page.
--sticky : Filter for 'sticky'; A boolean value (0 or 1) indicating whether
the node should be displayed at the top of lists in which it appears.
--translate : Filter for 'translate'; A boolean value (0 or 1) indicating
whether the node translation needs to be updated.
--language : Filter for 'language'; The language code (e.g. de or en-US) of
this node.
--type : Filter for 'type'; The machine-readable name (e.g. story or page) of
the type of this node.
--sql : Filter by SQL (EXPERIMENTAL); An SQL query string that returns nids
(e.g. "SELECT nid FROM nodes WHERE nid < 10").
--code : Filter by PHP code (EXPERIMENTAL); PHP code that prints or returns,
an array or CSV string of nids (e.g. "custom_get_my_nids();"). Don't include PHP
tags.
例如,
drush ne-export --type=article --file=article.txt
会将所有文章节点以序列化格式输出到article.txt。然后,您可以使用drush导入它们:
$ drush help ne-import
Import nodes previously exported with Node export.
Arguments:
Options:
--uid : User ID of user to save nodes as. If not given will use the user with
an ID of 1. You may specify 0 for the Anonymous user.
--file : The filename of the input file. If supplied, the node code will be
imported from that file, otherwise it will import to stdin.
例如:
drush ne-import --uid=1 --file=article.txt
*更新
您可以转到Drupal管理页面中所有内容的列表(D7中为/ admin / content),然后按内容类型过滤,然后选择全部,然后从下拉菜单中选择“节点导出”
then select 'Node export' from the dropdown menu
什么菜单?
您可以将Node导出模块用于上述目的。它说:
它允许用户导出节点,然后将其导入到另一个Drupal安装或同一站点中。使用该模块,您可以节省大量时间来建立新网站,这些网站的节点与您已经建立的网站相似,将节点迁移到新的Drupal版本,或者在开发/登台/生产站点之间迁移。
这可能有助于您划分结果。简单的bash脚本:
#!/bin/bash
# Run this script in Drupal root app directory!
# Requirements: drush command tool installed with ne-export command (you need Node Export module installed in Drupal)
maxRows=100
startFrom=0
for i in {0..17}
do
startFrom=$(( (i)*100 ))
echo "SELECT nid FROM node where node.type='noticia' limit $startFrom,$maxRows" # just for debugging
drush ne-export --file="nodes-exported/nodes-exported-$i.json" --format='json' --sql="SELECT nid FROM node where node.type='noticia' limit $startFrom,$maxRows" # of course set your own SQL here
done
exit 0