public final class RenameFileExtensions
extends java.lang.Object
RenameFileExtensions helps you to rename files or directories.| Modifier and Type | Method and Description |
|---|---|
static java.lang.String |
appendSystemtimeToFilename(java.io.File fileToRename)
Returns the filename from the given file with the systemtime.
|
static java.lang.String |
appendSystemtimeToFilename(java.io.File fileToRename,
java.util.Date add2Name)
Returns the filename from the given file with the systemtime.
|
static java.util.List<java.io.File> |
changeAllFilenameSuffix(java.io.File file,
java.lang.String oldSuffix,
java.lang.String newSuffix)
Changes all the Filenames with the new Suffix recursively.
|
static java.util.List<java.io.File> |
changeAllFilenameSuffix(java.io.File file,
java.lang.String oldSuffix,
java.lang.String newSuffix,
boolean delete)
Changes all the Filenames with the new Suffix recursively.
|
static boolean |
changeFilenameSuffix(java.io.File file,
java.lang.String newSuffix)
Changes the suffix from the Filename.
|
static boolean |
changeFilenameSuffix(java.io.File file,
java.lang.String newSuffix,
boolean delete)
Changes the suffix from the Filename.
|
static boolean |
forceToMoveFile(java.io.File srcFile,
java.io.File destinationFile)
Moves the given source file to the given destination file.
|
static boolean |
moveFile(java.io.File srcFile,
java.io.File destDir)
Moves the given source file to the destination Directory.
|
static boolean |
renameFile(java.io.File fileToRename,
java.io.File newFileName)
This method renames a given file.
|
static boolean |
renameFile(java.io.File fileToRename,
java.io.File newFileName,
boolean delete)
This method renames a given file.
|
static boolean |
renameFile(java.io.File fileToRename,
java.lang.String newFileNameWithoutAbsolutPath)
This method renames a given file.
|
static java.io.File |
renameFileWithSystemtime(java.io.File fileToRename)
Renames the given file and add to the filename the systemtime.
|
public static java.lang.String appendSystemtimeToFilename(java.io.File fileToRename)
fileToRename - The file to rename.public static java.lang.String appendSystemtimeToFilename(java.io.File fileToRename,
java.util.Date add2Name)
fileToRename - The file.add2Name - Adds the Date to the Filename.public static java.util.List<java.io.File> changeAllFilenameSuffix(java.io.File file,
java.lang.String oldSuffix,
java.lang.String newSuffix)
throws java.io.IOException,
FileDoesNotExistException,
FileIsADirectoryException
file - The file where to change the Filename with the new Suffix.oldSuffix - All files that have the old suffix will be renamed with the new Suffix.newSuffix - The new suffix.java.io.IOException - Signals that an I/O exception has occurred.FileDoesNotExistException - If the file does not exist.FileIsADirectoryException - the file is A directory exceptionpublic static java.util.List<java.io.File> changeAllFilenameSuffix(java.io.File file,
java.lang.String oldSuffix,
java.lang.String newSuffix,
boolean delete)
throws java.io.IOException,
FileDoesNotExistException,
FileIsADirectoryException
file - The file where to change the Filename with the new Suffix.oldSuffix - All files that have the old suffix will be renamed with the new Suffix.newSuffix - The new suffix.delete - If its true than its deletes the existing file with the same name. But before it
copys the contents into the new File.java.io.IOException - Signals that an I/O exception has occurred.FileDoesNotExistException - If the file does not exist.FileIsADirectoryException - the file is A directory exceptionpublic static boolean changeFilenameSuffix(java.io.File file,
java.lang.String newSuffix)
throws FileNotRenamedException,
FileDoesNotExistException,
java.io.IOException,
FileIsADirectoryException
file - The file to change.newSuffix - The new suffix. You must start with a dot. For instance: .xxxFileNotRenamedException - If the file could not renamed.FileDoesNotExistException - If the file does not exist.java.io.IOException - Signals that an I/O exception has occurred.FileIsADirectoryException - the file is A directory exceptionpublic static boolean changeFilenameSuffix(java.io.File file,
java.lang.String newSuffix,
boolean delete)
throws java.io.IOException,
FileDoesNotExistException,
FileIsADirectoryException
file - The file to change.newSuffix - The new suffix. You must start with a dot. For instance: .xxxdelete - If its true than its deletes the existing file with the same name. But before it
copys the contents into the new File.java.io.IOException - Signals that an I/O exception has occurred.FileDoesNotExistException - If the file does not exist.FileIsADirectoryException - the file is A directory exceptionpublic static boolean forceToMoveFile(java.io.File srcFile,
java.io.File destinationFile)
throws java.io.IOException,
FileIsADirectoryException
srcFile - The source file.destinationFile - The destination file.java.io.IOException - Signals that an I/O exception has occurred.FileIsADirectoryException - the file is A directory exceptionpublic static boolean moveFile(java.io.File srcFile,
java.io.File destDir)
throws java.io.IOException,
FileIsADirectoryException
srcFile - The source file.destDir - The destination directory.java.io.IOException - Signals that an I/O exception has occurred.FileIsADirectoryException - the file is A directory exceptionpublic static boolean renameFile(java.io.File fileToRename,
java.io.File newFileName)
throws java.io.IOException,
FileIsADirectoryException
fileToRename - The file to rename.newFileName - The new name from the file.java.io.IOException - Signals that an I/O exception has occurred.FileIsADirectoryException - the file is A directory exceptionpublic static boolean renameFile(java.io.File fileToRename,
java.io.File newFileName,
boolean delete)
throws java.io.IOException,
FileIsADirectoryException
fileToRename - The file to rename.newFileName - The new name from the file.delete - If true an attempt to copy the content from the file to rename to the new file and
then delete the file to rename otherwise not.java.io.IOException - Signals that an I/O exception has occurred.FileIsADirectoryException - the file is A directory exceptionpublic static boolean renameFile(java.io.File fileToRename,
java.lang.String newFileNameWithoutAbsolutPath)
throws java.io.IOException,
FileIsADirectoryException,
FileDoesNotExistException
fileToRename - The file to rename.newFileNameWithoutAbsolutPath - The new name from the file.java.io.IOException - Signals that an I/O exception has occurred.FileIsADirectoryException - the file is A directory exceptionFileDoesNotExistException - the file does not exist exceptionpublic static java.io.File renameFileWithSystemtime(java.io.File fileToRename)
throws java.io.IOException,
FileIsADirectoryException
fileToRename - The file to rename.java.io.IOException - Signals that an I/O exception has occurred.FileIsADirectoryException - the file is A directory exception