|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sourceforge.jaulp.file.rename.RenameFileUtils
public class RenameFileUtils
The Class RenameFileUtils helps you to rename files or directories.
Constructor Summary | |
---|---|
RenameFileUtils()
|
Method Summary | |
---|---|
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 destDir)
Moves the given source file to the destination Directory. |
static java.lang.String |
getAbsolutPathWithoutFilename(java.io.File file)
Gets the absolut path without the filename. |
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public RenameFileUtils()
Method Detail |
---|
public static java.lang.String appendSystemtimeToFilename(java.io.File fileToRename)
fileToRename
- The file.
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
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.public 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
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.public static boolean changeFilenameSuffix(java.io.File file, java.lang.String newSuffix) throws FileNotRenamedException, FileDoesNotExistException, java.io.IOException
file
- The file to change.newSuffix
- The new suffix. You must start with a dot. For instance: .xxx
FileNotRenamedException
- If the file could not renamed.
FileDoesNotExistException
- If the file does not exist.
java.io.IOException
- Signals that an I/O exception has occurred.public static boolean changeFilenameSuffix(java.io.File file, java.lang.String newSuffix, boolean delete) throws java.io.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.
java.io.IOException
- Signals that an I/O exception has occurred.
FileDoesNotExistException
- If the file does not exist.public static java.lang.String getAbsolutPathWithoutFilename(java.io.File file)
file
- the file.
public static boolean moveFile(java.io.File srcFile, java.io.File destDir)
srcFile
- The source file.destDir
- The destination directory.
public static boolean forceToMoveFile(java.io.File srcFile, java.io.File destDir)
srcFile
- The source file.destDir
- The destination directory.
public static boolean renameFile(java.io.File fileToRename, java.io.File newFileName)
fileToRename
- The file to rename.newFileName
- The new name from the file.
public static boolean renameFile(java.io.File fileToRename, java.io.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(java.io.File fileToRename, java.lang.String newFileNameWithoutAbsolutPath)
fileToRename
- The file to rename.newFileNameWithoutAbsolutPath
- The new name from the file.
public static java.io.File renameFileWithSystemtime(java.io.File fileToRename)
fileToRename
- The file to rename.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |