【问题标题】:How to move directory into subdirectory in Linux [closed]如何在Linux中将目录移动到子目录[关闭]
【发布时间】:2017-07-13 06:15:42
【问题描述】:

我完成了树的创建,只需要有关如何使用相对路径名将 sample_dir1(它是主目录的子目录)移动到 sample_dir 的帮助。查看下面的树将使问题更容易理解:

$
ULI101 Assignment 2.3:  Practice Specifying Path Names                Page 3/15
--------------------------------------------------------------------------------
sample_dir1
`-- sample_dir
    |-- admin
    |-- cambridge
    |   |-- cafeteria
    |   |-- library
    |   `-- security
    |       |-- annex
    |       |-- building
    |       `-- parking
    |-- faculty
    |-- history.exe
    |-- markham
    |   |-- annex
    |   |-- building1
    |   `-- parking
    |-- oxford
    |   |-- outline.doc
    |   |-- programming
    |   |   `-- report.pdf
    |   `-- security
    `-- stenton
        |-- gen_ed
        `-- lib_arts
            |-- english.txt
            `-- match.doc

sample_dir1 是您当前(主)目录的子目录。搬去 sample_dir 使用相对路径名:

【问题讨论】:

  • 您的问题不清楚。例如,你为什么用C 标签来标记它?您是否正在用 C 编写解决方案?还是您在 shell 中使用 Linux 命令?对如何解决问题有具体要求吗?请以不了解您所做工作背景的人的身份阅读您的问题,并考虑这对这样的人是否有意义。
  • 请注意,“尽快”就像在你的背上画一个反对的目标。请不要这样做 - 读者会在闲暇时回答。

标签: c linux unix relative-path


【解决方案1】:

如果您存在于 sample_dir 中,请在本地示例目录中尝试 然后: mv ../sample_dir1 ../sample_dir/ 如果不起作用,我很确定我不理解您的问题,或者路径名称对我来说不够清楚

【讨论】:

    【解决方案2】:
    sudo mv sample_dir1/ sample_dir/
    

    sample_dir1/ 替换为实际位置,然后将sample_dir/ 替换为新位置。

    【讨论】:

      猜你喜欢
      • 2016-02-08
      • 1970-01-01
      • 2022-01-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-05-01
      • 2023-03-17
      • 1970-01-01
      相关资源
      最近更新 更多