Moving a file or directory to another directory
From CodeCodex
Contents
Implementations[edit]
Java[edit]
// 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
Ruby[edit]
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
Zsh[edit]
Using zmv function
autoload zmv zmv -v file destiny
Using mv system command
mv -v file destiny