mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-08 01:26:03 +00:00
Add a renameTo method to the FilePath class
git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@9078 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
1 parent
82780ed40e
commit
680d4a42a4
1 file changed
+16
@@ -701,6 +701,22 @@ public final class FilePath implements Serializable {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Rename this file/directory to the target filepath. This FilePath and the target must
|
||||
* be on the some host
|
||||
*/
|
||||
public void renameTo(final FilePath target) throws IOException, InterruptedException {
|
||||
if(this.channel != target.channel) {
|
||||
throw new IOException("renameTo target must be on the same host");
|
||||
}
|
||||
act(new FileCallable<Void>() {
|
||||
public Void invoke(File f, VirtualChannel channel) throws IOException {
|
||||
f.renameTo(new File(target.remote));
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Copies this file to the specified target.
|
||||
*/
|
||||
|
||||
Reference in new issue
Block a user