I've created a .zip folder (compressed folder) using FileSystem, which is present in Java.nio package present in JDK 1.7 onwards.
URI zipUri = new URI("jar:" + fileUri.getScheme(), fileUri.getPath(), null);
FileSystem zipfs = FileSystems.newFileSystem(zipUri, env);
Now, I want to move the zipped folders from one directory to another, but I couldn't find any way to locate the zipped folders because it is a FileSystem and there is no method present to move it.
Files.move() works only with either file or directory, but not with zipped folders created from FileSystem.
Can anyone point me to the right direction pls?
How to move file to another directory in Java
Java.io.File does not contains any ready make move file method, but you can workaround with the following two alternatives :
File.renameTo(). Copy to new file and delete the original file. In the below two examples, you move a file “C:\carpeta1\archivo.zip” from one directory to another directory with the same file name “C:\carpeta2\archivo2.zip“.