作者:开心123 | 来源:互联网 | 2023-09-18 12:07
This question already has an answer here:
这个问题在这里已有答案:
- How to copy files in Groovy 7 answers
如何在Groovy 7答案中复制文件
I am working with Grails. I need to copy a file from one folder to another. Here are my attempts below ::
我正在和Grails合作。我需要将文件从一个文件夹复制到另一个文件夹。以下是我的尝试::
def wrapAll(){
def uploadList = Upload.findAllByIsWrapped(false)
if (uploadList){
uploadList.each {
def dist = new Dist(it.properties)
dist.filePath = it.filePath.replace("upload","dist")
def file = new File(it.filePath)
}
}
}
here it.filePath = web-app/apps/upload/test_txt_file.txt and dist.filePath = web-app/apps/dist/test_txt_file.txt
这里it.filePath = web-app / apps / upload / test_txt_file.txt和dist.filePath = web-app / apps / dist / test_txt_file.txt
I want that first file will be copied in second location.
我希望第一个文件将被复制到第二个位置。
1 个解决方案