Last active
May 30, 2023 20:22
-
-
Save munzz11/2b581f6964ad090d40d876017f9c2c75 to your computer and use it in GitHub Desktop.
Reindex all .active bag files in a dir and delete the .orig.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| DIRECTORY="$1" | |
| # Iterate over files in the directory and avoid ._ files. This is an edgecase from having ext4 files on an HFS system | |
| find "$DIRECTORY" -type f -name "*.bag.active" \! -name "._*" | while IFS= read -r file; do | |
| # Index the file | |
| rosbag reindex "$file" | |
| # Get the basename of the original .active.bag file | |
| orig_file="${file%%.*}" | |
| # Delete the file with the ".orig" extension | |
| rm "$orig_file.bag.orig.active" | |
| # Rename the output file without .active | |
| mv "$orig_file.bag.active" "$orig_file.bag" | |
| echo "Processed file: $file" | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment