Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact
/*******************************************************************************

        Rename a file, which can move it from one directory to another

*******************************************************************************/

private import  tango.io.Console,
                tango.io.FilePath;

void main(char[][] args)
{
        if (args.length is 3)
           {
           // address the source path
           auto src = new FilePath (args[1]);

           // rename file
           src.rename (args[2]);
           }
        else
           Cout ("usage: rename existingFile newName").newline;
}