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 String |
getAbsolutPathWithoutFilename(File file)
Deprecated.
use instead the same name method from
RenameFileExtensions. Note: will be removed in next minor release |
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.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
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.public static List<File> changeAllFilenameSuffix(File file, String oldSuffix, String newSuffix, boolean delete) throws IOException, FileDoesNotExistException
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.public static boolean changeFilenameSuffix(File file, String newSuffix) throws FileNotRenamedException, FileDoesNotExistException, IOException
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.public static boolean changeFilenameSuffix(File file, String newSuffix, boolean delete) throws IOException, FileDoesNotExistException
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.public static boolean forceToMoveFile(File srcFile, File destinationFile)
srcFile - The source file.destinationFile - The destination file.public static String getAbsolutPathWithoutFilename(File file)
RenameFileExtensions. file - the file.public static boolean moveFile(File srcFile, File destDir)
srcFile - The source file.destDir - The destination directory.public static boolean renameFile(File fileToRename, File newFileName)
fileToRename - The file to rename.newFileName - The new name from the file.public static boolean renameFile(File fileToRename, File newFileName, boolean delete)
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.public static boolean renameFile(File fileToRename, String newFileNameWithoutAbsolutPath)
fileToRename - The file to rename.newFileNameWithoutAbsolutPath - The new name from the file.Copyright © 2015–2018 Alpha Ro Group UG (haftungsbeschrÀngt). All rights reserved.