I am new to Scala.
I\'ve Googled a lot on how to move files in Scala, but have only found how to move files in Java. I tried to move files using Java import Java.io
os-lib makes it easy to copy files from one directory to another:
os.list(os.pwd/"public").map(os.move.into(_, os.pwd/"pub2"))
The java.io and java.nio libraries are generally difficult to work with (although not that ugly for this particular operation). It's best to rely on os-lib for filesystem operations.
os.move.into takes two arguments: the file that's being moved and the destination directory.
This code is flexible and easily modifiable. You could easily update it to only move files with a certain file extension.
See here for more info on how to use os-lib.