|
@@ -0,0 +1,31 @@
|
|
|
|
+import argparse
|
|
|
|
+import os
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+def main():
|
|
|
|
+ parser = argparse.ArgumentParser("生成label studio 需要的文件目录\n")
|
|
|
|
+ parser.add_argument("input", help="")
|
|
|
|
+ parser.add_argument("--wildcard")
|
|
|
|
+ parser.add_argument("output", help="")
|
|
|
|
+
|
|
|
|
+ args = parser.parse_args()
|
|
|
|
+
|
|
|
|
+ try:
|
|
|
|
+ with open(args.output, 'w') as outfile:
|
|
|
|
+
|
|
|
|
+ # 遍历目录中的文件和文件夹
|
|
|
|
+ for root, dirs, files in os.walk(args.input):
|
|
|
|
+ # 只输出文件名,不包括文件夹
|
|
|
|
+ for file in files:
|
|
|
|
+ if file.startswith("."):
|
|
|
|
+ continue
|
|
|
|
+ if args.wildcard and file.endswith(args.wildcard):
|
|
|
|
+ file_path = os.path.join(root, file)
|
|
|
|
+ outfile.write('http://192.168.10.18:10088/' + file_path + '\n')
|
|
|
|
+
|
|
|
|
+ except Exception as e:
|
|
|
|
+ print(e)
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+if __name__ == '__main__':
|
|
|
|
+ main()
|