27 files_to_reindex = [
"_2021-05-25-17-47-01.bag.active",
28 "_2021-05-25-17-53-47.bag.active",
29 "_2021-05-25-18-14-12.bag.active",
30 "_2021-05-25-18-19-06.bag.active",
31 "_2021-05-25-18-24-50.bag.active",
32 "_2021-05-25-18-54-32.bag.active",
33 "_2021-05-25-19-06-02.bag.active",
34 "_2021-05-25-19-19-45.bag.active",
35 "_2021-05-25-20-32-22.bag.active",
36 "_2021-05-25-20-49-05.bag.active",
37 "_2021-05-26-13-09-39.bag.active",
38 "_2021-05-26-13-33-10.bag.active",
39 "_2021-05-26-17-26-06.bag.active",
40 "_2021-05-26-19-45-45.bag.active",
41 "_2021-05-27-20-34-31.bag.active"]
44 for filename
in files_to_reindex:
45 print(
"Reindexing " + str(filename))
49 command =
"rosbag reindex " + str(filename)
50 reindex_proc = subprocess.Popen(command, stdin=subprocess.PIPE, shell=
True, cwd=source_folder,
51 executable=
'/bin/bash')
55 temp_file_name = str(filename[:-7]) +
".orig.active"
56 if (temp_file_name
in os.listdir(source_folder)):
62 os.rename(filename, filename[:-7])
65 print(
"Finished re-indexing " + str(filename))
71 print(
"Need 1 arguments: process_bag.py <path to source folder with .bag.active files> ")
74 source_folder = sys.argv[1]
80if __name__ ==
"__main__":
def reindex_bag_files(source_folder)