public final class RenameFileExtensions extends Object
RenameFileExtensions helps you to rename files or directories.| Constructor and Description |
|---|
RenameFileExtensions() |
| Modifier and Type | Method and Description |
|---|---|
static String |
appendSystemtimeToFilename(File fileToRename)
Returns the filename from the given file with the systemtime.
|
static String |
appendSystemtimeToFilename(File fileToRename,
Date add2Name)
Returns the filename from the given file with the systemtime.
|
static List<File> |
changeAllFilenameSuffix(File file,
String oldSuffix,
String newSuffix)
Changes all the Filenames with the new Suffix recursively.
|
static List<File> |
changeAllFilenameSuffix(File file,
String oldSuffix,
String newSuffix,
boolean delete)
Changes all the Filenames with the new Suffix recursively.
|
static boolean |
changeFilenameSuffix(File file,
String newSuffix)
Changes the suffix from the Filename.
|
static boolean |
changeFilenameSuffix(File file,
String newSuffix,
boolean delete)
Changes the suffix from the Filename.
|
static boolean |
forceToMoveFile(File srcFile,
File destinationFile)
Moves the given source file to the given destination file.
|
static boolean |
moveFile(File srcFile,
File destDir)
Moves the given source file to the destination Directory.
|
static boolean |
renameFile(File fileToRename,
File newFileName)
This method renames a given file.
|
static boolean |
renameFile(File fileToRename,
File newFileName,
boolean delete)
This method renames a given file.
|
static boolean |
renameFile(File fileToRename,
String newFileNameWithoutAbsolutPath)
This method renames a given file.
|
static File |
renameFileWithSystemtime(File fileToRename)
Renames the given file and add to the filename the systemtime.
|
public static String appendSystemtimeToFilename(File fileToRename)
fileToRename - The file to rename.public static String appendSystemtimeToFilename(File fileToRename, Date add2Name)
fileToRename - The file.add2Name - Adds the Date to the Filename.public static List<File> changeAllFilenameSuffix(File file, String oldSuffix, String newSuffix) throws 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.IOException - Signals that an I/O exception has occurred.FileDoesNotExistException - If the file does not exist.FileIsADirectoryException - the file is A directory exceptionpublic static List<File> changeAllFilenameSuffix(File file, String oldSuffix, String newSuffix, boolean delete) throws 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.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(File file, String newSuffix) throws FileNotRenamedException, FileDoesNotExistException, 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.IOException - Signals that an I/O exception has occurred.FileIsADirectoryException - the file is A directory exceptionpublic static boolean changeFilenameSuffix(File file, String newSuffix, boolean delete) throws 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.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(File srcFile, File destinationFile) throws IOException, FileIsADirectoryException
srcFile - The source file.destinationFile - The destination file.IOException - Signals that an I/O exception has occurred.FileIsADirectoryException - the file is A directory exceptionpublic static boolean moveFile(File srcFile, File destDir) throws IOException, FileIsADirectoryException
srcFile - The source file.destDir - The destination directory.IOException - Signals that an I/O exception has occurred.FileIsADirectoryException - the file is A directory exceptionpublic static boolean renameFile(File fileToRename, File newFileName) throws IOException, FileIsADirectoryException
fileToRename - The file to rename.newFileName - The new name from the file.IOException - Signals that an I/O exception has occurred.FileIsADirectoryException - the file is A directory exceptionpublic static boolean renameFile(File fileToRename, File newFileName, boolean delete) throws 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.IOException - Signals that an I/O exception has occurred.FileIsADirectoryException - the file is A directory exceptionpublic static boolean renameFile(File fileToRename, String newFileNameWithoutAbsolutPath) throws IOException, FileIsADirectoryException, FileDoesNotExistException
fileToRename - The file to rename.newFileNameWithoutAbsolutPath - The new name from the file.IOException - Signals that an I/O exception has occurred.FileIsADirectoryException - the file is A directory exceptionFileDoesNotExistException - the file does not exist exceptionpublic static File renameFileWithSystemtime(File fileToRename) throws IOException, FileIsADirectoryException
fileToRename - The file to rename.IOException - Signals that an I/O exception has occurred.FileIsADirectoryException - the file is A directory exceptionCopyright © 2015–2018 Alpha Ro Group UG (haftungsbeschrÀngt). All rights reserved.