BorgBackup extract specific file from archive 2025
Specified 'BorgBackup' for clarity, included 'specific file' for focused results, and added the year for the most current information.
BorgBackup is a powerful deduplicating archiver that allows users to efficiently back up and restore data. When it comes to extracting files from an archive, Borg provides flexibility, enabling you to extract not just entire archives, but also specific files or directories. Here’s a comprehensive overview of how you can accomplish this.
borg extract CommandThe borg extract command is the primary method for retrieving data from a Borg archive. By default, this command will extract all contents within the specified archive, but it also supports targeted extractions. This means you can specify certain files or directories that you wish to recover.
To extract a specific file or folder, you can use the following command format:
borg extract /path/to/repository::archive-name path/to/file
Identify the Archive: Determine the archive name you want to extract from. You can list archives stored in your repository with borg list /path/to/repository.
Use the Extract Command: To extract just a specific file from the archive, you would execute a command like:
borg extract /path/to/repository::archive-name /path/to/specific/file
This will extract only the selected file, leaving the rest of the archive intact.
Dry Run Option: It is often useful to perform a dry run first. You can do this by adding the --dry-run flag, which will show you what would be extracted without actually performing the extraction:
borg extract --dry-run /path/to/repository::archive-name /path/to/specific/file
If you have an archive named backup-2025-08-01 and you want to extract a file located at documents/report.txt, you would use:
borg extract /path/to/repository::backup-2025-08-01 documents/report.txt
Borg also offers a variety of other options that can enhance your extraction process:
--list: Lists the contents of the archive(s) as part of the extraction process.--dry-run: Displays which files would be extracted without performing the action.-v: Provides verbose output for better visibility into what the command is processing.BorgBackup provides a robust way to extract individual files from your backups, saving time and storage space by allowing you to avoid unnecessary data restoration. By using the commands specified above, you can quickly retrieve the files you need from your archives. If you're interested in more detailed commands or options, you can refer to the official BorgBackup documentation for further guidance.