开发者

How to rename a directory?

How do I rename a directory in Ruby?

I see how to rename individual fil开发者_开发问答es, but not folders.


File.rename will let you rename directories:

File.rename './my-directory', './my-renamed-directory'


FileUtils.mv old_name, new_name

Check the docs for more info


require 'fileutils'
FileUtils.mv sourcedir, newdir
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜