Autopsy  4.7.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
Static Public Member Functions | Private Member Functions | Static Private Attributes | List of all members
org.sleuthkit.autopsy.coreutils.FileUtil Class Reference

Static Public Member Functions

static String copyFile (String source, String destFolder, String newName, String ext, boolean overwrite) throws IOException
 
static String copyFolder (String source, String path, String folderName) throws IOException
 
static boolean deleteDir (File dirPath)
 
static boolean deleteFileDir (File path)
 
static String escapeFileName (String fileName)
 
static boolean hasReadWriteAccess (Path dirPath)
 

Private Member Functions

 FileUtil ()
 

Static Private Attributes

static final Logger logger = Logger.getLogger(FileUtil.class.getName())
 
static final String TEMP_FILE_EXT = null
 
static final String TEMP_FILE_NAME = "Autopsy"
 

Detailed Description

File and dir utilities

Definition at line 31 of file FileUtil.java.

Constructor & Destructor Documentation

org.sleuthkit.autopsy.coreutils.FileUtil.FileUtil ( )
private

Prevents instantiation of this utility class.

Definition at line 203 of file FileUtil.java.

Member Function Documentation

static String org.sleuthkit.autopsy.coreutils.FileUtil.copyFile ( String  source,
String  destFolder,
String  newName,
String  ext,
boolean  overwrite 
) throws IOException
static

Copy a file to a new directory, potentially new file name, and overwrite old one if requested

Parameters
sourcesource file path
destFolderdestination folder path
newNamefile name of the copied file, which can be different from original
extfile extension, e.g. ".java"
overwriteif new file, already exists, overwrite it (delete it first)
Returns
path to the created file, or null if file was not created
Exceptions
IOExceptionexception thrown if file copying failed

Definition at line 116 of file FileUtil.java.

static String org.sleuthkit.autopsy.coreutils.FileUtil.copyFolder ( String  source,
String  path,
String  folderName 
) throws IOException
static

Copy a folder into a new directory.

Parameters
sourcepath to the source folder
pathdestination path of the new folder
folderNamename of the new folder
Returns
path to the new folder if created, null if it was not created
Exceptions
IOExceptionexception thrown if file copying failed

Definition at line 150 of file FileUtil.java.

static boolean org.sleuthkit.autopsy.coreutils.FileUtil.deleteDir ( File  dirPath)
static

Recursively delete all of the files and sub-directories in a directory. Use deleteFileDir() if you are not sure if the path is a file or directory.

Parameters
dirPathPath of the directory to delete
Returns
true if the dir was deleted with no errors. False otherwise (including if the passed in path was for a file).

Definition at line 47 of file FileUtil.java.

Referenced by org.sleuthkit.autopsy.casemodule.Case.clearTempSubDir(), org.sleuthkit.autopsy.casemodule.Case.deleteCase(), org.sleuthkit.autopsy.coreutils.FileUtil.deleteFileDir(), and org.sleuthkit.autopsy.keywordsearch.SolrSearchService.deleteTextIndex().

static boolean org.sleuthkit.autopsy.coreutils.FileUtil.deleteFileDir ( File  path)
static

Delete the file or dir at the given path. If the path is for a directory, recursively delete its contents.

Parameters
paththe path to the file or directory to delete
Returns
true if the file or directory were deleted with no errors. False otherwise.

Definition at line 87 of file FileUtil.java.

References org.sleuthkit.autopsy.coreutils.FileUtil.deleteDir().

Referenced by org.sleuthkit.autopsy.directorytree.ExtractAction.runExtractionTasks().

static String org.sleuthkit.autopsy.coreutils.FileUtil.escapeFileName ( String  fileName)
static

Escape special characters in a file name or a file name component

Parameters
fileNameto escape
Returns
escaped string

Definition at line 169 of file FileUtil.java.

Referenced by org.sleuthkit.autopsy.directorytree.ExtractAction.extractFile(), org.sleuthkit.autopsy.directorytree.ExtractAction.extractFiles(), and org.sleuthkit.autopsy.timeline.actions.SaveSnapshotAsReport.SaveSnapshotAsReport().

static boolean org.sleuthkit.autopsy.coreutils.FileUtil.hasReadWriteAccess ( Path  dirPath)
static

Test if the current user has read and write access to the dirPath.

Parameters
dirPathThe path to the directory to test for read and write access.
Returns
True if we have both read and write access, false otherwise.

Definition at line 183 of file FileUtil.java.

Member Data Documentation

final Logger org.sleuthkit.autopsy.coreutils.FileUtil.logger = Logger.getLogger(FileUtil.class.getName())
staticprivate

Definition at line 33 of file FileUtil.java.

final String org.sleuthkit.autopsy.coreutils.FileUtil.TEMP_FILE_EXT = null
staticprivate

Definition at line 35 of file FileUtil.java.

final String org.sleuthkit.autopsy.coreutils.FileUtil.TEMP_FILE_NAME = "Autopsy"
staticprivate

Definition at line 34 of file FileUtil.java.


The documentation for this class was generated from the following file:

Copyright © 2012-2016 Basis Technology. Generated on: Mon Jun 18 2018
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.