Autopsy  4.1
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

Constructor & Destructor Documentation

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

Prevents instantiation of this utility class.

Definition at line 203 of file

Member Function Documentation

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

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

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)
path to the created file, or null if file was not created
IOExceptionexception thrown if file copying failed

Definition at line 116 of file

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

Copy a folder into a new directory.

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

Definition at line 150 of file

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

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.

dirPathPath of the directory to delete
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

Referenced by org.sleuthkit.autopsy.coreutils.FileUtil.deleteFileDir().

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

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

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

Definition at line 87 of file

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)

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

fileNameto escape
escaped string

Definition at line 169 of file

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)

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

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

Definition at line 183 of file

Member Data Documentation

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

Definition at line 33 of file

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

Definition at line 35 of file

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

Definition at line 34 of file

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

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