I want the mp4 file shooting date to be the xml file name - windows

In Windows 10 environment, I would like to change the name of both “file with extension mp4” and “file with extension xml” to the shooting date of mp4 file.
C0001.MP4
C0001M01.XML
C0002.MP4
C0002M01.XML
Specifically, I want to change the file name as follows.
2019-10-23_13-10-32.MP4
2019-10-23_13-10-32.XML
2019-10-23_13-10-49.MP4
2019-10-23_13-10-49.XML
I tried to think that using the ext option would give me the expected result, but I didn't get the expected result.
First time
C:\Users\user>exiftool "-FileName<CreateDate" -d "%Y-%m-%d_%H-%M-%S%%-c.%%e" -ext "xml" C:\hoge
Warning: [minor] Error 3 placing ::NonRealTimeMetaLtcChangeTableLtcChangeStatus in structure or list - C:/hoge/C0001M01.XML
Warning: No writable tags set from C:/hoge/C0001M01.XML
Warning: [minor] Error 3 placing ::NonRealTimeMetaAudioFormatAudioRecPortTrackDst in structure or list - C:/hoge/C0002M01.XML
Warning: No writable tags set from C:/hoge/C0002M01.XML
1 directories scanned
0 image files updated
2 image files unchanged
Second time
C:\Users\user>exiftool "-FileName<CreateDate" -d "%Y-%m-%d_%H-%M-%S%%-c.%%e" -ext "*" C:\hoge
Warning: [minor] The ExtractEmbedded option may find more tags in the movie data - C:/hoge/C0001.MP4
Warning: [minor] Error 3 placing ::NonRealTimeMetaLtcChangeTableLtcChangeStatus in structure or list - C:/hoge/C0001M01.XML
Warning: No writable tags set from C:/hoge/C0001M01.XML
Warning: [minor] The ExtractEmbedded option may find more tags in the movie data - C:/hoge/C0002.MP4
Warning: [minor] Error 3 placing ::NonRealTimeMetaAudioFormatAudioRecPortPort in structure or list - C:/hoge/C0002M01.XML
Warning: No writable tags set from C:/hoge/C0002M01.XML
1 directories scanned
2 image files updated
2 image files unchanged
Added November 22, 2019
I tried the code posted in this link .
C:\Users\user>exiftool -TagsFromFile %d%f.mp4 "-FileName<CreateDate" -ext xml C:\hoge
Warning: Error opening file - C:/mp4data/C0001M01.mp4
Warning: Error opening file - C:/mp4data/C0002M01.mp4
1 directories scanned
0 image files updated
2 image files unchanged
I think the cause of the error is that “.mp4 file name” and “.xml file name” do not match.
Since “M01” is always a fixed value, is there any way to batch process it?
C0001.MP4
C0001M01.XML
C0002.MP4
C0002M01.XML

Related

How to add the variables in MIB files in the linux?

Basically, I have added one variable called "sysFirst" (as shown in the below picture)in the available "RFC1213-MIB.txt" file. After addition of the variable I have validated also using command
smilint -l 6 -i namelength-32 ./RFC1213-MIB.txt
So I got the following result
root#pdu:/usr/share/snmp/mibs# smilint -l 6 -i namelength-32 ./RFC1213-MIB.txt
./RFC1213-MIB.txt:15: warning: redefinition of identifier `SNMPv2-SMI::mib-2'
/usr/share/mibs/ietf/SNMPv2-SMI:13: info: previous definition of `mib-2'
./RFC1213-MIB.txt:19: warning: redefinition of identifier `SNMPv2-TC::DisplayString'
/usr/share/mibs/ietf/SNMPv2-TC:53: info: previous definition of `DisplayString'
./RFC1213-MIB.txt:28: warning: redefinition of identifier `SNMPv2-TC::PhysAddress'
/usr/share/mibs/ietf/SNMPv2-TC:87: info: previous definition of `PhysAddress'
./RFC1213-MIB.txt:56: warning: redefinition of identifier `SNMPv2-SMI::transmission'
/usr/share/mibs/ietf/SNMPv2-SMI:14: info: previous definition of `transmission'
./RFC1213-MIB.txt:268: index element `ifIndex' of row `ifEntry' must have a range restriction
./RFC1213-MIB.txt:616: index element `atIfIndex' of row `atEntry' must have a range restriction
./RFC1213-MIB.txt:1308: index element `ipNetToMediaIfIndex' of row `ipNetToMediaEntry' must have a range restriction
./RFC1213-MIB.txt:19: warning: type `DisplayString' has no format specification
./RFC1213-MIB.txt:28: warning: type `PhysAddress' has no format specification
Then after restarting the SNMP daemon I observed it not reflecting in the MIB browser as shown in the below image,
What will be the reason for not reflecting the variable in the MIB browser?
Any help will be really appreciated.
Whatever MIB files we will make the same we need to add them to the MIB browser by using the load mib browser option normally we can find the same in the file option from the menu bar.
After adding the same we can use all the SNMP commands from any device which consists of the MIB Browser.

schema file at path is invalid because no version is specified

I run my dbt command in a loop and save its contents to a .yml file. This works well and generates a schema in my .yml file accurately:
for file in models/l30_mart/*.sql; do
table=$(basename "$file" .sql)
dbt run-operation generate_model_yaml --args "{\"model_name\": \"$table\"}" > test.yml
done
However, in the example above, I am just saving the test.yml file in the root directory. When I try to save the file in another path for example models/l30_mart/test.yml, it doesn't work:
for file in models/l30_mart/*.sql; do
table=$(basename "$file" .sql)
dbt run-operation generate_model_yaml --args "{\"model_name\": \"$table\"}" > models/l30_mart/test.yml
done
In this case, when I open the test.ymlfile, I see this:
12:06:42 Running with dbt=1.0.1
12:06:43 Encountered an error:
Compilation Error
The schema file at models/l30_mart/test.yml is invalid because no version is specified. Please consult the documentation for more information on schema.yml syntax:
https://docs.getdbt.com/docs/schemayml-files
It's probably a syntax mistake. Do I need any quotes to specify the path? or brackets? Why can't I save the .yml file in the same folder? Similarly, something like this and try to save different files with the tablename, it also doesn't work:
for file in models/l30_mart/*.sql; do
table=$(basename "$file" .sql)
dbt run-operation generate_model_yaml --args "{\"model_name\": \"$table\"}" > models/l30_mart/$table.yml
done
In this case, the files either have this output:
20:39:44 Running with dbt=1.0.1
20:39:45 Encountered an error:
Compilation Error
The schema file at models/l30_mart/firsttable.yml is invalid because no version is specified. Please consult the documentation for more information on schema.yml syntax:
https://docs.getdbt.com/docs/schemayml-files
or this (eg in the second tablename.yml file):
20:39:48 Running with dbt=1.0.1
20:39:49 Encountered an error:
Parsing Error
Error reading dbt_4flow: l30_mart/firstablename.yml - Runtime Error
Syntax error near line 2
------------------------------
1 | 20:39:44 Running with dbt=1.0.1
2 | 20:39:45 Encountered an error:
3 | Compilation Error
4 | The schema file at models/l30_mart/firsttablename.yml is invalid because no version is specified. Please consult the documentation for more information on schema.yml syntax:
5 |
Raw Error:
------------------------------
mapping values are not allowed in this context
in "<unicode string>", line 2, column 31
Note that the secondtablename.yml mentions the firsttablename.yml.

Microsoft Custom Translator: "The document '._..._...txt' is not a valid text file as it contains one or more invalid characters"

When using the zip file format to combine two parallel files, after data file upload we get the error message:
The document '._{name}_{lang}.txt' is not a valid {type} file as it contains one or more invalid characters.
The issue is that MacOS includes system files in the ZIP archive, and Microsoft tries to read them as data files because of the language suffix and .txt extension.
unzip -l data1.zip
Archive: data1.zip
Length Date Time Name
--------- ---------- ----- ----
0 04-09-2020 00:57 data1/
108746839 04-08-2020 23:55 data1/data_en.txt
120 04-08-2020 23:55 __MACOSX/data1/._data_en.txt
126795036 04-08-2020 23:56 data1/data_de.txt
120 04-08-2020 23:56 __MACOSX/data1/._data_de.txt
--------- -------
235542115 5 files
The fix is to compress them in a way that they are not added, or just remove them:
zip -d data1.zip __MACOSX*
zip -d data1.zip __DS_Store*
See https://apple.stackexchange.com/questions/239578/compress-without-ds-store-and-macosx, Mac zip compress without __MACOSX folder?...
Thanks to #ScottG for debugging.

Uncompress recursively using 7-Zip from command line

I'm attempting to uncompress several .gz files using 7-Zip from the command line. My files are in directories like so:
Desktop/copyto/1/
file1.gz
file2.gz
Desktop/copyto/2/
file1.gz
file2.gz
file3.gz
I would like to recursively uncompress all the .gz files into each's orginal location and as well as deleting the remaining .gz files when they are done uncompressing.
I have tried the following command with no luck:
7z.exe x C:\Users\MYUSERNAME\Desktop\copyto\*\*.gz -r
I assumed that this would extract recursively. I get the error:
Processing archive: C:\Users\MYUSERNAME\Desktop\copyto\1\file1.gz
Can not open output file file1
Sub items Errors: 1
Any idea what's going on?
Given your command line, my guess is that your current working directory isn't any subdirectory of your home directory (C:\Users\MYUSERNAME) or the public user directory (C:\Users\Public), which means you probably don't have access rights. For example, if I run the following from C:\Program Files\7-Zip, I get the same error with a 7-Zip file:
C:\Program Files\7-Zip>7z x C:\Users\MYUSERNAME\Desktop\migrated\annex_k.7z -r
7-Zip [64] 9.38 beta Copyright (c) 1999-2014 Igor Pavlov 2015-01-03
Processing archive: C:\Users\MYUSERNAME\Desktop\migrated\annex_k.7z
ERROR: Can not open output file : .\annex_k\include\annex_k\errno.h
Skipping annex_k\include\annex_k\errno.h
ERROR: Can not open output file : .\annex_k\include\annex_k\handler.h
Skipping annex_k\include\annex_k\handler.h
...
Extracting annex_k\include\annex_k
Extracting annex_k\include
Extracting annex_k
Sub items Errors: 10
Archives with Errors: 1
Sub items Errors: 10
Kernel Time = 0.031 = 39%
User Time = 0.031 = 39%
Process Time = 0.062 = 78% Virtual Memory = 3 MB
Global Time = 0.080 = 100% Physical Memory = 4 MB
Notice that not even an annex_k directory was created:
C:\Program Files\7-Zip>dir /b
7-zip.chm
7-zip.dll
7-zip32.dll
7z.dll
7z.exe
7z.sfx
7zCon.sfx
7zFM.exe
7zG.exe
descript.ion
History.txt
Lang
License.txt
readme.txt
The solution is to extract to a directory in which you have access rights. You can specify an output directory using something like -oC:\Users\MYUSERNAME\Desktop\copyto\1. If you absolutely need to do this in a directory in which you don't have write access ordinarily, you'd need to run the command prompt as an administrator and extract the file as usual.

file's date changes after zip in and out again, according to XCOPY

So, here's the problem: I have files which are regular files, and they are put into a ZIP file (see below for details on ZIP). Then I unzip them (see below for details on the tool used), and the files are restored. The date of the file is restored, as in standard in the ZIP/UNZIP tools used. When querying using DIR, or in Windows Explorer, the files involved have the same date as they had, before being handled by the ZIP/UNZIP process.
So, all OK.
But then, I'm using the XCOPY /D command, to further manipulate different copies of those files on the disk ... and, XCOPY says : one file is newer than the other one. Given the fact the date, hour, up until minutes is the same .. the difference would be regarding a smaller entity, like seconds ?
All involved disks have NTFS file system.
Example:
C:\my>dir C:\windows\Background_mycomputer.cmd C:\my\directory\Background_mycomputer.cmd
Volume in drive C is mycomputerC
Volume Serial Number is 1234-5678
Directory of C:\windows
31/12/2014 19:50 51 Background_mycomputer.cmd
1 File(s) 51 bytes
Directory of C:\my\directory
31/12/2014 19:50 51 Background_mycomputer.cmd
1 File(s) 51 bytes
0 Dir(s) 33.655.316.480 bytes free
C:\my>xcopy C:\windows\Background_mycomputer.cmd C:\my\directory\Background_mycomputer.cmd /D
Overwrite C:\my\directory\Background_mycomputer.cmd (Yes/No/All)? y
C:\windows\Background_mycomputer.cmd
1 File(s) copied
C:\my>xcopy C:\my\directory\Background_mycomputer.cmd C:\windows\Background_mycomputer.cmd /D
0 File(s) copied
C:\my>xcopy C:\windows\Background_mycomputer.cmd C:\my\directory\Background_mycomputer.cmd /D
0 File(s) copied
C:\my>unzip -v
UnZip 6.00 of 20 April 2009, by Info-ZIP. Maintained by C. Spieler. Send
bug reports using http://www.info-zip.org/zip-bug.html; see README for details.
Latest sources and executables are at ftp://ftp.info-zip.org/pub/infozip/ ;
see ftp://ftp.info-zip.org/pub/infozip/UnZip.html for other sites.
Compiled with Microsoft C 13.10 (Visual C++ 7.1) for
Windows 9x / Windows NT/2K/XP/2K3 (32-bit) on Apr 20 2009.
UnZip special compilation options:
ASM_CRC
COPYRIGHT_CLEAN (PKZIP 0.9x unreducing method not supported)
NTSD_EAS
SET_DIR_ATTRIB
TIMESTAMP
UNIXBACKUP
USE_EF_UT_TIME
USE_UNSHRINK (PKZIP/Zip 1.x unshrinking method supported)
USE_DEFLATE64 (PKZIP 4.x Deflate64(tm) supported)
UNICODE_SUPPORT [wide-chars] (handle UTF-8 paths)
MBCS-support (multibyte character support, MB_CUR_MAX = 1)
LARGE_FILE_SUPPORT (large files over 2 GiB supported)
ZIP64_SUPPORT (archives using Zip64 for large files supported)
USE_BZIP2 (PKZIP 4.6+, using bzip2 lib version 1.0.5, 10-Dec-2007)
VMS_TEXT_CONV
[decryption, version 2.11 of 05 Jan 2007]
UnZip and ZipInfo environment options:
UNZIP: [none]
UNZIPOPT: [none]
ZIPINFO: [none]
ZIPINFOOPT: [none]
C:\my>ver
Microsoft Windows [Version 6.1.7601]
C:\my>zip -?
Copyright (c) 1990-2006 Info-ZIP - Type 'zip "-L"' for software license.
Zip 2.32 (June 19th 2006). Usage:
zip [-options] [-b path] [-t mmddyyyy] [-n suffixes] [zipfile list] [-xi list]
The default action is to add or replace zipfile entries from list, which
can include the special name - to compress standard input.
If zipfile and list are omitted, zip compresses stdin to stdout.
-f freshen: only changed files -u update: only changed or new files
-d delete entries in zipfile -m move into zipfile (delete files)
-r recurse into directories -j junk (don't record) directory names
-0 store only -l convert LF to CR LF (-ll CR LF to LF)
-1 compress faster -9 compress better
-q quiet operation -v verbose operation/print version info
-c add one-line comments -z add zipfile comment
-# read names from stdin -o make zipfile as old as latest entry
-x exclude the following names -i include only the following names
-F fix zipfile (-FF try harder) -D do not add directory entries
-A adjust self-extracting exe -J junk zipfile prefix (unzipsfx)
-T test zipfile integrity -X eXclude eXtra file attributes
-! use privileges (if granted) to obtain all aspects of WinNT security
-R PKZIP recursion (see manual)
-$ include volume label -S include system and hidden files
-e encrypt -n don't compress these suffixes
C:\my>
Question: I do not want XCOPY to make updates where I know they are invalid cause the time format is doing something wrong. How do I prevent that ?
From how I see, there's different things involved, being XCOPY, very specific ZIP and UNZIP, and NTFS file system. Which one is doing something wrong ?
I must stress that apart from ZIP and UNZIP, there are no other changes done to the file, like changing 1 file, then making a change to another one, in less than 60 seconds time.
At moment of test, the time shown was NOT the current time, and not close to it either. No file is adjusting to the current time, the times refer to last changes of the file in question, which may be any time in the past. In this case, it's one day later, but it can be anything.
I noticed the peculiar behavior Raymond Chen describes when writing a Powershell script (GitHub link) to freshen a zip archive using the System.IO.Compression and System.IO.Compression.FileSystem libraries.
Interestingly, Zip archives can store multiple copies of the same file with identical metadata (name, relative path, modification dates). Extracting the second copy of the file will fail in Windows Explorer because the file already exists.
When trying to prevent re-zipping a file was already archived, I checked the relative path and date, and noticed that there was a discrepancy of up to two seconds in the LastWriteTime. This workaround compensates for the loss of precision:
$AlreadyArchivedFile = ($WriteArchive.Entries | Where-Object {#zip will store multiple copies of the exact same file - prevent this by checking if already archived.
(($_.FullName -eq $RelativePath) -and ($_.Length -eq $File.Length) ) -and
([math]::Abs(($_.LastWriteTime.UtcDateTime - $File.LastWriteTimeUtc).Seconds) -le 2) #ZipFileExtensions timestamps are only precise within 2 seconds.
})
Also, the IsDaylightSavingTime flag is not stored in the Zip archive. As a result I was surprised when extracted files became an hour newer than the original archived file. I tried this several times and saw the extracted file's timestamp incremented by an hour every time it was compressed and extracted.
Here's a very ugly workaround that decreases the archived file time by one hour to make the original source file and extracted file timestamps consistent:
If($File.LastWriteTime.IsDaylightSavingTime() -and $ArchivedFile){#HACK: fix for buggy date - adds an hour inside archive when the zipped file was created during PDT (files created during PST are not affected).
$entry = $WriteArchive.GetEntry($RelativePath)
$entry.LastWriteTime = ($File.LastWriteTime.ToLocalTime() - (New-TimeSpan -Hours 1))
}
There's probably a better way to handle this. Unfortunately I'm not aware of any way to store a Daylight Savings indicator for a file in a .Zip archive, and that information is lost.

Resources