如何在Windows中使用带空格的目录名使用FileUtils cp?

时间:2012-09-10 16:58:20

标签: ruby windows directory cp fileutils

我尝试使用此主题中的建议无济于事:How to use copyfile when there are spaces in the directory name?。要清楚,我正在使用的目录已经是双引号,我已经尝试转义空格,但仍然得到相同的错误。这是我收到的错误消息:

    Error: Failed to open PDF file:
    C:/Documents
    Error: Failed to open PDF file:
    and
    Error: Failed to open PDF file:
    Settings/cpengelly/My
    Error: Failed to open PDF file:
    Documents/Dropbox/theproject/tmp/working/main
    Error: Failed to open PDF file:
    pdf.pdf
    Errors encountered.  No output created.
    Done.  Input errors, so no output created.

这里发生了什么?

1 个答案:

答案 0 :(得分:0)

您只需将目录名称放在双引号中即可。例子 -

FileUtils.cp("C:\\Program Files\\FileZilla\\dbghelp.dll","c:\\temp")