diff --git a/ChangeLog b/ChangeLog index adac048b..d2874ad8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,11 +1,8 @@ 2024-07-15 Jan Kotanski + * create output dir is does not exists (#696) * fix ScanFileinScanNameDir name to ScanNames (#694) * fix support for ScanNames=False (#695) - * tagged as v4.11.1 - -2024-07-15 Jan Kotanski - * fix ScanFileinScanNameDir name to ScanNames (#694) - * tagged as v4.11.1 + * tagged as v4.12.0 2024-07-11 Jan Kotanski * add --online-xml-file option for nxscreate stdcomp (#687) diff --git a/nxstools/nxsfileinfo.py b/nxstools/nxsfileinfo.py index adf04523..e8e6a5f1 100644 --- a/nxstools/nxsfileinfo.py +++ b/nxstools/nxsfileinfo.py @@ -1639,6 +1639,9 @@ def show(self, root, options): metadata = self.metadata(root, options) if metadata: if options.output: + fdir, fn = os.path.split(os.path.abspath(options.output)) + if not os.path.isdir(fdir): + os.makedirs(fdir, exist_ok=True) chmod = None try: chmod = int(options.chmod, 8) @@ -3013,6 +3016,8 @@ def groupmetadata(cls, options): elif options.group and options.group[0]: if imfile: metadir, _ = os.path.split(os.path.abspath(imfile)) + if not os.path.isdir(metadir): + os.makedirs(metadir, exist_ok=True) omfile = os.path.join( metadir, "%s.scan.json" % options.group[0]) if options.writefiles: @@ -3173,6 +3178,9 @@ def show(self, options): metadata, datablocks, attachments = self.groupmetadata(options) if metadata: if options.output: + fdir, fn = os.path.split(os.path.abspath(options.output)) + if not os.path.isdir(fdir): + os.makedirs(fdir, exist_ok=True) chmod = None try: chmod = int(options.chmod, 8) @@ -3517,6 +3525,9 @@ def show(self, options): metadata = self.datablock(options) if metadata: if options.output: + fdir, fn = os.path.split(os.path.abspath(options.output)) + if not os.path.isdir(fdir): + os.makedirs(fdir, exist_ok=True) chmod = None try: chmod = int(options.chmod, 8) @@ -3687,6 +3698,9 @@ def show(self, options): metadata = self.sample(options) if metadata: if options.output: + fdir, fn = os.path.split(os.path.abspath(options.output)) + if not os.path.isdir(fdir): + os.makedirs(fdir, exist_ok=True) chmod = None try: chmod = int(options.chmod, 8) @@ -4573,6 +4587,9 @@ def show(self, root, options): metadata = self.attachment(root, options) if metadata: if options.output: + fdir, fn = os.path.split(os.path.abspath(options.output)) + if not os.path.isdir(fdir): + os.makedirs(fdir, exist_ok=True) chmod = None try: chmod = int(options.chmod, 8) @@ -4731,6 +4748,9 @@ def show(self, options): metadata = self.instrument(options) if metadata: if options.output: + fdir, fn = os.path.split(os.path.abspath(options.output)) + if not os.path.isdir(fdir): + os.makedirs(fdir, exist_ok=True) chmod = None try: chmod = int(options.chmod, 8)