I am trying to archive all the files in the root directory of the folder but have the backups as one of the folders in the root directory so I wanted to exclude it so each backup after the first one isn't backing up the backups folder (aka increasing the size of the archive exponentially) in java, If it is not possible with GZIPOutputStream or ZIPOutputStream could you recommend me an alternative method for backing up files that allows excluding files and/or directories from the backup? Thank you for reading!
Is it possible to exclude files and/or directories when using GZIPOutputStream or ZIPOutputStream in java?
1.3k Views Asked by JordanPlayz158 At
1
There are 1 best solutions below
Related Questions in JAVA
- Add image to JCheckBoxMenuItem
- How to access invisible Unordered List element with Selenium WebDriver using Java
- Inheritance in Java, apparent type vs actual type
- Java catch the ball Game
- Access objects variable & method by name
- GridBagLayout is displaying JTextField and JTextArea as short, vertical lines
- Perform a task each interval
- Compound classes stored in an array are not accessible in selenium java
- How to avoid concurrent access to a resource?
- Why does processing goes slower on implementing try catch block in java?
- Redirect inside java interceptor
- Push toolbar content below statusbar
- Animation in Java on top of JPanel
- JPA - How to query with a LIKE operator in combination with an AttributeConverter
- Java Assign a Value to an array cell
Related Questions in ZIPOUTPUTSTREAM
- ZipOutputStream create zip with file dont include directories
- Removing a jar files META-INF folder in Java
- How to create a multipart zip file and read it back?
- Zip Jasper reports
- JAVA - Corrupt ZIP file using ZipOutptuStream with FileInputStream
- ZipOutPutStream, ZipEntry return null when I try to dezip
- Generated ZIP file is corrupt / invalid
- .war file created using ZipOutputStream fails to deploy
- Is there a way in Java to preserve Created and Accessed attributes of a file when are added to a zip archive?
- Is it possible to exclude files and/or directories when using GZIPOutputStream or ZIPOutputStream in java?
- Java - Zip output stream dynamic buffer size
- Create a zip consisting of multiple fileoutputStreams objects
- Java - ZipOutputStream within try-with-resources
- ZipOutputStream does not create new entries for Directories
- Make zip from directory and download it In Spring without creating new files or directories
Related Questions in GZIPOUTPUTSTREAM
- How can I convert a string into a GZIP Base64 string with ByteArrayOutputStream?
- performance of GZIPOutputStream vs BufferedOutputStream
- Is it possible to exclude files and/or directories when using GZIPOutputStream or ZIPOutputStream in java?
- Compressing the final output data into gzip format
- Change in GZIPOutputStream behavior in Java 17?
- String to GZIPOutputStream
- GZIP decompress string and byte conversion
- Is bytearrayoutputstream wrapped in GZIPOutputStream blocking operation
- GZIPOutputStream problem with my class which extending OutputStream
- Java- concatenating compressed data with Deflater or GZIPOutputStream
- org.apache.hadoop.io.compress.GzipCodec, in this class GzipOutputStream is not closed, so memory leak
- Python gzip and Java GZIPOutputStream give different results
- Java GZIPOutputStream appears to allocate unnecessary byte arrays?
- Why does Files.copy cause out of memory error when creating large file
- read zipped ion content from s3 in java
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
To be able to exclude certain files or folders from a Zip or GZip you have two options:
Don't forget to include the driveletter (ie:
C:) on Windows systems.You can see that it is also possible to exclude complete folders, not only files. But the full (or relative) path to file/folder is necessary!
Edit: not only is the documentation missing the
filesToExcludelist definition, it is also unclear about theabsolutepath requirements for allnew File()calls. Updated answer to reflect this. You either need to use a absolute path or a relative path. Relative path are made with the.prepend. Current example is tested and working on Windows 10.