Hi, i've got a question for the csv Export.
Forum.Search takes me to ather topics (GPS .. ) and custom Headernames ..
Problem:
find * -name "*.pdf" -mmin +10 | xargs -I '{}' exiftool -csv -Title -FileSize >> QM_List.csv {}
I want to list pdf-files after export, but no duplicated filename in the QM_List. (Thats why the pipe)
All fine at all.
But;
SourceFile,Title,FileSize \LF
Val1,val2,val3 \LF
comes always before the Exif-Values.
Is there an option to write the Header only in the first line?
Ver= 12.42 / centos
The way to do this is to run ExifTool only once. What exactly are your "find" and "xargs" commands doing? You should be able to do this using ExifTool (see common mistake #3 (https://exiftool.org/mistakes.html#M3)).
- Phil
Hi Phil,
thanks a lot for your answer.
I hope i get yout point correctly.
But i can't find a way to filter changedate like (less than a minute) ...
This is my try ... but "files failed condition"; is there a condition to compare tag like FileModifyDate with current timestamp+/- min,hours, days ?
exiftool -FileModifyDate -if "$FileModifyDate > '$DateTimeOriginal' " -csv -Title -FileSize >QM_List.csv -ext pdf -r .
###############################
Thank you for this great forum.
ExifTool provides a "ShiftTime" helper function. From the documentation:
"ShiftTime"
Shifts EXIF-formatted date/time string by a specified amount. Start
with a leading minus sign to shift backwards in time. See
Image::ExifTool::Shift.pl (https://exiftool.org/Shift.html) for details about shift syntax. For example,
to shift a date/time value back by one year:
exiftool -p '${createdate;ShiftTime("-1:0:0 0")}' a.jpg
So you can do something like this:
exiftool -FileModifyDate -if "${FileModifyDate;ShiftTime('-0:1')} gt $DateTimeOriginal" -csv -Title -FileSize -ext pdf -r . >QM_List.csv
For example, here I'm shifting FileModifyDate back by 1 minute and comparing to DateTimeOriginal. You must use the Perl string comparisons (gt, lt, ge, le, eq, ne) and not the numerical comparison operators (>, <, >=, <=, == !=). I'm using Windows CMD quoting because you seem to have switched to Windows in your last example.
- Phil
Quote from: emja on November 03, 2022, 06:56:19 AMIs there an option to write the Header only in the first line?
Exiftool can't exclude the header line using the
-csv option (https://exiftool.org/exiftool_pod.html#csv-CSVFILE) so that you can append the new file list to the previous CSV.
There are a couple of options, though. You can roll your own CSV format using the
-n (
--printConv) option (https://exiftool.org/exiftool_pod.html#n---printConv). See near the end of FAQ #12 (https://exiftool.org/faq.html#Q12).
You could also pipe through
tail as in this StackOverflow Answer (https://stackoverflow.com/questions/7318497/omitting-the-first-line-from-any-linux-command-output/7318550#7318550).
While Phil is correct that you could probably use exiftool directly, I don't think FAQ 3 is a problem here. I'm not really familiar with linux commands but it looks like you're creating a file list with
find and directly passing that list to exiftool via STDIN. That would avoid looping and running exiftool once per file, which is the big performance hit.
Looking closer, I think you can drop the
xargs part as exiftool can read directly from STDIN by using a
- Correction, using the -@ (Argfile) option (https://exiftool.org/exiftool_pod.html#ARGFILE) along with a -. Something like
find * -name "*.pdf" -mmin +10 | exiftool -csv -Title -FileSize -@ - >> QM_List.csvI think in your case, piping through
tail would work fine. So the final command could be like this(?) I'm not sure how
tail works with piping, so some editing may be required.
find * -name "*.pdf" -mmin +10 | tail -n +2 | exiftool -csv -Title -FileSize -@ - >> QM_List.csvWhile I love exiftool and always advocate it, I like the cleanness of a linux command like this over the more complex exiftool command.
Quote from: StarGeek on November 05, 2022, 11:19:06 AMfind * -name "*.pdf" -mmin +10 | exiftool -csv -Title -FileSize - >> QM_List.csv
I think you may need
-@ - instead of just
- in the exiftool arguments.
- Phil
Oops, yep, corrected my post.
Thank you Phil, Thank you StarGeek !
Its amazing, both ways work fine.
-@ - = great new for me
Image::ExifTool::Shift.pl = is a fantasic new possibility
Exiftool is great universe. For me as an exiffool, i'm very thankful for your help.