Package gmbh.pagina.tools.gradle.mac_app
Class FileUtils
java.lang.Object
gmbh.pagina.tools.gradle.mac_app.FileUtils
Tools for file interactions.
All methods in this class are static methods. No need to set up any FileUtils object.
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidCopy a directory to a target directory.static voidCopy an input file to a destination directory, keeping the name.static voidcopyToFile(File input, File output) Copy an input file to a target, possibly renaming it along the way.static voiddeleteRecursively(File file) Delete a file or directory recursively.static voidsetExecutable(File file) Mark a file as executable.static voidCreates a tar.gz archive.static voidUnzip an input file to a target.static voidwriteToFile(File file, String content) Write a string to a text file that does not yet need to exist.static voidZips a file or directory to a target.
-
Method Details
-
copyToDir
Copy an input file to a destination directory, keeping the name.- Parameters:
input- The input file to copy.output- The directory it is copied into.
-
copyToFile
Copy an input file to a target, possibly renaming it along the way.- Parameters:
input- The input file to copy.output- The file it will be after copying.
-
copyDir
Copy a directory to a target directory.- Parameters:
input- The input directory to copy.output- The directory it will be after copying.- Throws:
IOException- If file writing goes wrong.
-
unzip
Unzip an input file to a target.- Parameters:
zipFile- The input file to copy.unzippedFile- The file once unzipped.
-
zip
Zips a file or directory to a target.- Parameters:
unzippedFile- The input file to zip.zipFile- The file once zipped.
-
tarGz
Creates a tar.gz archive.- Parameters:
infile- The input file to archive.outfile- The file once archived.
-
writeToFile
Write a string to a text file that does not yet need to exist.- Parameters:
file- Target file.content- Text content to write.- Throws:
IOException- If the file cannot be created or written.
-
setExecutable
Mark a file as executable. Only works on UNIX-like systems.- Parameters:
file- file to mark executable
-
deleteRecursively
Delete a file or directory recursively.- Parameters:
file- file or directory to delete
-