开发者

Cut a directory?

Is t开发者_JAVA技巧here a method to cut a directory/file in groovy instead of copyingto a new location and then deleting the original directory/file ?


You mean move a file?

You can do:

File file = new File( 'original.txt' )  
File dir = new File( 'destFolder' )  
boolean fileMoved = file.renameTo( new File( dir, file.getName() ) )  

Which uses the Java File.renameTo method

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜