我正在更改 Drupal 安装中的目录结构,需要删除除文件名本身之外的所有路径数据。
所以基本结构是:
+-------------+--------------+---------+-----------+-------------+----------+-------+----------------------------------------------------------------------------------+-----------------------+
| entity_type | bundle | deleted | entity_id | revision_id | language | delta | field_filename_value | field_filename_format |
+-------------+--------------+---------+-----------+-------------+----------+-------+----------------------------------------------------------------------------------+-----------------------+
文件名存储在field_filename_value
. 这是一个示例记录:
+-------------+--------------+---------+-----------+-------------+----------+-------+----------------------------------------------------------------------------------+-----------------------+
| entity_type | bundle | deleted | entity_id | revision_id | language | delta | field_filename_value | field_filename_format |
+-------------+--------------+---------+-----------+-------------+----------+-------+----------------------------------------------------------------------------------+-----------------------+
| node | presentation | 0 | 11 | 11 | und | 0 | /really long path name/with lots of words/167 Clarence Ashley - Coo Coo Bird.mp3 | NULL |
+-------------+--------------+---------+-----------+-------------+----------+-------+----------------------------------------------------------------------------------+-----------------------+
该荒谬的文件名值需要从以下位置更改:
/真长的路径名/有很多字/167 Clarence Ashley - Coo Coo Bird.mp3
对此:
第167话--咕咕咕鸟.mp3
撇开在文件/目录名称中使用空格的不良做法不谈,您将如何纠正这个问题?是否可以单独使用 MySQL 功能?
作为一个额外的挑战,一些文件的深度可能超过 2 个目录。