Moving a file or directory to another directory
From CodeCodex
Contents |
[edit] Implementations
[edit] Java
// This will not move files across drives.
// File (or directory) to be moved
File file = new File("filename");
// Destination directory
File dir = new File("directoryname");
// Move file to new directory
boolean success = file.renameTo(new File(dir, file.getName()));
if (!success) {
// File was not successfully moved
}
- Original Source: The Java Developers Almanac 1.4
[edit] Ruby
Moves file(s) src to dest. If file and dest exist on the different disk partition, the file is copied instead.
require 'fileutils' FileUtils.mv src, dest
- Original Source: RDoc Documentation
[edit] Zsh
Using zmv function
autoload zmv zmv -v file destiny
Using mv system command
mv -v file destiny

