-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmeta1.txt
251 lines (167 loc) · 12.8 KB
/
meta1.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
# Get metadata of files with Vim, 7zip, and CMD
I don't know if this has been done before; I feel like the answer is "no". I looked up "Get metadata with Vim, 7zip, and CMD" on Google and found nothing. Why does 7zip not support MD5?
(Click the "Raw" button on this web page to enable word wrapping.)
````
Step 0. Know that you can paste Vim command mode commands in with : > Edit > Paste
Step 1. Get a list of your files.
Open Vim then add the following text. Only add the text between "--->" and "<---" which you have customized to your files.
start of "file" ("1,1")--->wmic datafile where Name="C:\\path\\to\\the\\files\\filenameU46HOJDGB2.ext" get CreationDate,EightDotThreeFileName,Extension,FileName,FileSize,FileType,LastAccessed,LastModified
"C:\Program Files\7-Zip\7z" h -scrcsha256 filename7CIVJTLRWS.ext
<---end of "file" ("4,0")
where "U46HOJDGB2" and "7CIVJTLRWS" is the number part of your filenames. All filenames are in the format of "TheSameText#", where "TheSameText" is any string which is the entirety of each filename if you remove the numbering part of it; the numbering part is "#", which means any positive integer from 1 to 281474980000000.
Then in command mode run
:$ | 1,4t.O
In normal mode run
#@@
where "#" is the number of files you want to get metadata on minus 2. So if you have 7 files you want to get metadata on it would be
5@@
and the output would be
start of "file"--->wmic datafile where Name="C:\\path\\to\\the\\files\\filenameU46HOJDGB2.ext" get CreationDate,EightDotThreeFileName,Extension,FileName,FileSize,FileType,LastAccessed,LastModified
"C:\Program Files\7-Zip\7z" h -scrcsha256 filename7CIVJTLRWS.ext
wmic datafile where Name="C:\\path\\to\\the\\files\\filenameU46HOJDGB2.ext" get CreationDate,EightDotThreeFileName,Extension,FileName,FileSize,FileType,LastAccessed,LastModified
"C:\Program Files\7-Zip\7z" h -scrcsha256 filename7CIVJTLRWS.ext
wmic datafile where Name="C:\\path\\to\\the\\files\\filenameU46HOJDGB2.ext" get CreationDate,EightDotThreeFileName,Extension,FileName,FileSize,FileType,LastAccessed,LastModified
"C:\Program Files\7-Zip\7z" h -scrcsha256 filename7CIVJTLRWS.ext
wmic datafile where Name="C:\\path\\to\\the\\files\\filenameU46HOJDGB2.ext" get CreationDate,EightDotThreeFileName,Extension,FileName,FileSize,FileType,LastAccessed,LastModified
"C:\Program Files\7-Zip\7z" h -scrcsha256 filename7CIVJTLRWS.ext
wmic datafile where Name="C:\\path\\to\\the\\files\\filenameU46HOJDGB2.ext" get CreationDate,EightDotThreeFileName,Extension,FileName,FileSize,FileType,LastAccessed,LastModified
"C:\Program Files\7-Zip\7z" h -scrcsha256 filename7CIVJTLRWS.ext
<---end of "file"
Then run
:let i=1 | g/U46HOJDGB2/s//\=i/ | let i=i+1
:let j=1 | g/7CIVJTLRWS/s//\=j/ | let j=j+1
Step 2. Get the unformated metadata (see Appendix A)
Open CMD
Go to the directory with the files that you want to get meta data on, run "cd C:\path\to\the\files"
Run "cls"
Copy and paste all of those Step 1 commands into CMD to run them.
Press Ctrl+A
Paste the unformatted metadata into Vim then run the command in Step 3.
Step 3. (referenced above) Format metadata
:%s/\(CreationDate\)\s\+\(EightDotThreeFileName\)\s\+\(Extension\)\s\+\(FileName\)\s\+\(FileSize\)\s\+\(FileType\)\s\+\(LastAccessed\)\s\+\(LastModified\)\s*/\1\r\2\r\3\r\4\r\5\r\6\r\7\r\8/g | %s/CreationDate\n\(.*\n.*\n.*\n.*\n.*\n.*\n.*\n\)\(\S\+ \S\+\|\S\+\)/CreationDate: \2\r\1/g | %s/EightDotThreeFileName\n\(.*\n.*\n.*\n.*\n.*\n.*\n\)\s\{2,}.\+\\\(\S\+ \S\+\|\S\+\)/EightDotThreeFileName: \2\r\1/g | %s/Extension\n\(.*\n.*\n.*\n.*\n.*\n\)\s\{2,}\(\S\+ \S\+\|\S\+\)/Extension: \2\r\1/g | %s/FileName\n\(.*\n.*\n.*\n.*\n\)\s\{2,}\(\S\+ \S\+\|\S\+\)/FileName: \2\r\1/g | %s/FileSize\n\(.*\n.*\n.*\n\)\s\{2,}\(\S\+ \S\+\|\S\+\)/FileSize: \2\r\1/g | %s/FileType\n\(.*\n.*\n\)\s\{2,}\(\S\+ \S\+\|\S\+\)/FileType: \2\r\1/g | %s/LastAccessed\n\(.*\n\)\s\{2,}\(\S\+ \S\+\|\S\+\)/LastAccessed: \2\r\1/g | %s/LastModified\n\s\{2,}\(\S\+ \S\+\|\S\+\)/LastModified: \1/g | %s/\(.*\n\)\{2}.*>.* h -scrcsha256\(.*\n\)\{15}//g | %s/.*>wmic datafile where Name=.*\\/Filename: /g | %s/" get CreationDate,E.*//g | %s/\nEverything is Ok\n\n.*>$//g | %s/\n\nEverything is Ok$//g
(See Appendix B for some info on this command.)
^
works with output of
v
Appendix A. (referenced above) Unformatted metadata example
C:\path\to\the\files>wmic datafile where Name="C:\\path\\to\\the\\files\\filename#.ext" get CreationDate,EightDotThreeFileName,Extension,FileName,FileSize,FileType,LastAccessed,LastModified
CreationDate EightDotThreeFileName Extension FileName FileSize FileType LastAccessed LastModified
YYYYMMDDHHMMSS.######+*** c:\path\to\the\files\filename#.ext ext filename# #### [letters or 1 space] YYYYMMDDHHMMSS.######+*** YYYYMMDDHHMMSS.######
C:\path\to\the\files>"C:\Program Files\7-Zip\7z" h -scrcsha256 filename#.ext
7-Zip 18.05 (x64) : Copyright (c) 1999-2018 Igor Pavlov : 2018-04-30
Scanning
1 file, ###### bytes (### [letters])
SHA256 Size Name
---------------------------------------------------------------- ------------- ------------
0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF ###### filename#.ext
---------------------------------------------------------------- ------------- ------------
0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF ######
Size: ######
SHA256 for data: 0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF
Everything is Ok
C:\path\to\the\files>
C:\path\to\the\files>wmic datafile where Name="C:\\path\\to\\the\\files\\filename#.ext" get CreationDate,EightDotThreeFileName,Extension,FileName,FileSize,FileType,LastAccessed,LastModified
CreationDate EightDotThreeFileName Extension FileName FileSize FileType LastAccessed LastModified
YYYYMMDDHHMMSS.######+*** c:\path\to\the\files\filename#.ext ext filename# #### [letters or 1 space] YYYYMMDDHHMMSS.######+*** YYYYMMDDHHMMSS.######
C:\path\to\the\files>"C:\Program Files\7-Zip\7z" h -scrcsha256 filename#.ext
7-Zip 18.05 (x64) : Copyright (c) 1999-2018 Igor Pavlov : 2018-04-30
Scanning
1 file, ###### bytes (### [letters])
SHA256 Size Name
---------------------------------------------------------------- ------------- ------------
0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF ###### filename#.ext
---------------------------------------------------------------- ------------- ------------
0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF ######
Size: ######
SHA256 for data: 0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF
Everything is Ok
C:\path\to\the\files>
C:\path\to\the\files>wmic datafile where Name="C:\\path\\to\\the\\files\\filename#.ext" get CreationDate,EightDotThreeFileName,Extension,FileName,FileSize,FileType,LastAccessed,LastModified
CreationDate EightDotThreeFileName Extension FileName FileSize FileType LastAccessed LastModified
YYYYMMDDHHMMSS.######+*** c:\path\to\the\files\filename#.ext ext filename# #### [letters or 1 space] YYYYMMDDHHMMSS.######+*** YYYYMMDDHHMMSS.######
C:\path\to\the\files>"C:\Program Files\7-Zip\7z" h -scrcsha256 filename#.ext
7-Zip 18.05 (x64) : Copyright (c) 1999-2018 Igor Pavlov : 2018-04-30
Scanning
1 file, ###### bytes (### [letters])
SHA256 Size Name
---------------------------------------------------------------- ------------- ------------
0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF ###### filename#.ext
---------------------------------------------------------------- ------------- ------------
0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF ######
Size: ######
SHA256 for data: 0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF
Everything is Ok
Appendix B. (referenced above) How the Vim command works
(Not needed:
:%s/.:\\.*7z" h -scrcsha256 \(.*\n\)\{15}//g
That was used for something else.)
Simple model:
unique1 unique2 unique3 unique4 unique5 unique6 unique7 unique8
unique9 unique10 unique11 unique12 unique13 unique14 unique15 unique16
:%s/\(unique1\)\s\+\(unique2\)\s\+\(unique3\)\s\+\(unique4\)\s\+\(unique5\)\s\+\(unique6\)\s\+\(unique7\)\s\+\(unique8\)\s*/\1\r\2\r\3\r\4\r\5\r\6\r\7\r\8/g
unique1
unique2
unique3
unique4
unique5
unique6
unique7
unique8
unique9 unique10 unique11 unique12 unique13 unique14 unique15 unique16
:%s/\n\(.*\n.*\n.*\n.*\n.*\n.*\n.*\n\)\(unique9\)/\2\r\1/g | %s/\n\(.*\n.*\n.*\n.*\n.*\n.*\n\).*\(unique10\)/\2\r\1/g | %s/\n\(.*\n.*\n.*\n.*\n.*\n\).*\(unique11\)/\2\r\1/g | %s/\n\(.*\n.*\n.*\n.*\n\).*\(unique12\)/\2\r\1/g | %s/\n\(.*\n.*\n.*\n\).*\(unique13\)/\2\r\1/g | %s/\n\(.*\n.*\n\).*\(unique14\)/\2\r\1/g | %s/\n\(.*\n\).*\(unique15\)/\2\r\1/g | %s/\n.*\(unique16\)/\1/g
unique1 unique9
unique2 unique10
unique3 unique11
unique4 unique12
unique5 unique13
unique6 unique14
unique7 unique15
unique8 unique16
Which correlates to the following:
CreationDate EightDotThreeFileName Extension FileName FileSize FileType LastAccessed LastModified
YYYYMMDDHHMMSS.######+*** c:\path\to\the\files\filename#.ext ext filename# #### [letters or 1 space] YYYYMMDDHHMMSS.######+*** YYYYMMDDHHMMSS.######
:%s/\(CreationDate\)\s\+\(EightDotThreeFileName\)\s\+\(Extension\)\s\+\(FileName\)\s\+\(FileSize\)\s\+\(FileType\)\s\+\(LastAccessed\)\s\+\(LastModified\)\s*/\1\r\2\r\3\r\4\r\5\r\6\r\7\r\8/g
CreationDate
EightDotThreeFileName
Extension
FileName
FileSize
FileType
LastAccessed
LastModified
YYYYMMDDHHMMSS.######+*** c:\path\to\the\files\filename#.ext ext filename# #### [letters or 1 space] YYYYMMDDHHMMSS.######+*** YYYYMMDDHHMMSS.######
:%s/\n\(.*\n.*\n.*\n.*\n.*\n.*\n.*\n\)\(\S\+ \S\+\|\S\+\)/: \2\r\1/g | %s/\n\(.*\n.*\n.*\n.*\n.*\n.*\n\)\s\{2,}.\+\\\(\S\+ \S\+\|\S\+\)/: \2\r\1/g | %s/\n\(.*\n.*\n.*\n.*\n.*\n\)\s\{2,}\(\S\+ \S\+\|\S\+\)/: \2\r\1/g | %s/\n\(.*\n.*\n.*\n.*\n\)\s\{2,}\(\S\+ \S\+\|\S\+\)/: \2\r\1/g | %s/\n\(.*\n.*\n.*\n\)\s\{2,}\(\S\+ \S\+\|\S\+\)/: \2\r\1/g | %s/\n\(.*\n.*\n\)\s\{2,}\(\S\+ \S\+\|\S\+\)/: \2\r\1/g | %s/\n\(.*\n\)\s\{2,}\(\S\+ \S\+\|\S\+\)/: \2\r\1/g | %s/\n\s\{2,}\(\S\+ \S\+\|\S\+\)/: \1/g
CreationDate: YYYYMMDDHHMMSS.######+***
EightDotThreeFileName: filename#.ext
Extension: ext
FileName: filename#
FileSize: ####
FileType: [letters or 1 space character]
LastAccessed: YYYYMMDDHHMMSS.######+***
LastModified: YYYYMMDDHHMMSS.######
^
similar
v
CreationDate EightDotThreeFileName Extension FileName FileSize FileType LastAccessed LastModified
YYYYMMDDHHMMSS.######+*** c:\path\to\the\files\filename#.ext ext filename# #### [letters or 1 space] YYYYMMDDHHMMSS.######+*** YYYYMMDDHHMMSS.######
:%s/\(CreationDate\)\s\+\(EightDotThreeFileName\)\s\+\(Extension\)\s\+\(FileName\)\s\+\(FileSize\)\s\+\(FileType\)\s\+\(LastAccessed\)\s\+\(LastModified\)\s*/\1\r\2\r\3\r\4\r\5\r\6\r\7\r\8/g | %s/CreationDate\n\(.*\n.*\n.*\n.*\n.*\n.*\n.*\n\)\(\S\+ \S\+\|\S\+\)/CreationDate: \2\r\1/g | %s/EightDotThreeFileName\n\(.*\n.*\n.*\n.*\n.*\n.*\n\)\s\{2,}.\+\\\(\S\+ \S\+\|\S\+\)/EightDotThreeFileName: \2\r\1/g | %s/Extension\n\(.*\n.*\n.*\n.*\n.*\n\)\s\{2,}\(\S\+ \S\+\|\S\+\)/Extension: \2\r\1/g | %s/FileName\n\(.*\n.*\n.*\n.*\n\)\s\{2,}\(\S\+ \S\+\|\S\+\)/FileName: \2\r\1/g | %s/FileSize\n\(.*\n.*\n.*\n\)\s\{2,}\(\S\+ \S\+\|\S\+\)/FileSize: \2\r\1/g | %s/FileType\n\(.*\n.*\n\)\s\{2,}\(\S\+ \S\+\|\S\+\)/FileType: \2\r\1/g | %s/LastAccessed\n\(.*\n\)\s\{2,}\(\S\+ \S\+\|\S\+\)/LastAccessed: \2\r\1/g | %s/LastModified\n\s\{2,}\(\S\+ \S\+\|\S\+\)/LastModified: \1/g
CreationDate: YYYYMMDDHHMMSS.######+***
EightDotThreeFileName: filename#.ext
Extension: ext
FileName: filename#
FileSize: ####
FileType: [letters or 1 space character]
LastAccessed: YYYYMMDDHHMMSS.######+***
LastModified: YYYYMMDDHHMMSS.######
delete other crap
v
:%s/\(.*\n\)\{2}.*>.* h -scrcsha256\(.*\n\)\{15}//g
:%s/.*>wmic datafile where Name=.*\\/Filename: /g
:%s/" get CreationDate,E.*//g
:%s/\nEverything is Ok\n\n.*>$//g
:%s/\n\nEverything is Ok$//g
^
combined
v
See Step 3 above for the combined command.
````