Tuesday, 4 August 2015

Renaming a File or Directory in QTP/UFT

The following code will rename the file/directory.Here 'FileOrDirNameBefore' is the directory name to be renamed to 'FileOrDirNameAfter'.

    File f1= new File("FileOrDirNameBefore");
    File f2= new File("FileOrDirNameAfter");
    boolean success = f1.renameTo(f2);
    if (!success) {
        // File was not successfully renamed
    }

No comments:

Post a Comment