<commit_before>#!/usr/bin/perl
# <NAME> (http://momentary.eu/) Last change: Tue 12 Apr 2016

# This script searches recursively in it's directory for jpegs, 
# finds those with rotating orientation tags, and resets them to horizontal.
# It reports progress to the screen.

# I wrote this (my first Perl program) without realising the excellent functionality
# already built-in to command-line exiftool:
# http://search.cpan.org/~exiftool/Image-ExifTool-9.76/exiftool
# So, most simply, one can, in a folder of images: $ exiftool orientation= *
# Or to go more advanced (and obviate this script) look at his whitebalance example.

# Prerequisites:  a system with Perl & module Image::ExifTool.

# Drop this file into the parent folder that you want to work on, open a Terminal there,
# enter the name of this file, hit return, and watch the progress!
# Alternatively, something like:
#   perl ~/Files/IT_stack/jpgorhor/jpgorhor.pl
#   perl /mnt/BX200/Files/IT_stack/jpgorhor/jpgorhor.pl -Syu 2>&1 | tee jpgorhor.txt

use strict;  use warnings;  use Image::ExifTool;  use File::Find;  use IO::Tee;

# first, create a time check:
END { print "This Perl program ran for ", time() - $^T, " seconds.  All changes reported.\n"}

# prepare an output log:
my $llf = "jpgorhor.txt";
my $llfh;
open( $llfh, '>', $llf ) or die("Can't initialise $llf: $!");
my $tee = IO::Tee->new( $llfh, \*STDOUT );
select $tee;

#  now work through the directory, recursively (looking for rotatable jpegs):
#
#  first define a suitable ExifTool object to be used in the subroutine (and two counters):
my $exifTool = new Image::ExifTool;  my $cdir = 0; my $cfls = 0; my $cjpg = 0; my $cchg = 0;

# now do all of the work:
find(\&rotatable_jpegs, ".");   # finished!
print "Finished! Looked in $cdir Directories at $cfls Files of which $cjpg were jpegs\n";<commit_msg>removed superfluous Bash tee<commit_after>#!/usr/bin/perl
# <NAME> (http://momentary.eu/) Last change: Tue 12 Apr 2016

# This script searches recursively in it's directory for jpegs, 
# finds those with rotating orientation tags, and resets them to horizontal.
# It reports progress to the screen and to a log file.

# I wrote this (my first Perl program) without realising the excellent functionality
# already built-in to command-line exiftool:
# http://search.cpan.org/~exiftool/Image-ExifTool-9.76/exiftool
# So, most simply, one can, in a folder of images: $ exiftool orientation= *
# Or to go more advanced (and obviate this script) look at his whitebalance example.

# Prerequisites:  a system with Perl & module Image::ExifTool.

# Drop this file into the parent folder that you want to work on, open a Terminal there,
# enter the name of this file, hit return, and watch the progress!
# Alternatively, something like:
#   perl /mnt/BX200/Files/IT_stack/jpgorhor/jpgorhor.pl
#   perl /mnt/WD2000JD/Files/IT_stack/jpgorhor/jpgorhor.pl

use strict;  use warnings;  use Image::ExifTool;  use File::Find;  use IO::Tee;

# first, create a time check:
END { print "This Perl program ran for ", time() - $^T, " seconds.  All changes reported.\n"}

# prepare an output log:
my $llf = "jpgorhor.txt";
my $llfh;
open( $llfh, '>', $llf ) or die("Can't initialise $llf: $!");
my $tee = IO::Tee->new( $llfh, \*STDOUT );
select $tee;

#  now work through the directory, recursively (looking for rotatable jpegs):
#
#  first define a suitable ExifTool object to be used in the subroutine (and two counters):
my $exifTool = new Image::ExifTool;  my $cdir = 0; my $cfls = 0; my $cjpg = 0; my $cchg = 0;

# now do all of the work:
find(\&rotatable_jpegs, ".");   # finished!
print "Finished! Looked in $cdir Directories at $cfls Files of which $cjpg were jpegs\n";
{'fraction_non_alphanumeric': 0.11640498105035192, 'fraction_numerical': 0.01028695181375203, 'mean_word_length': 4.204225352112676, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6556455', 'n_tokens_mistral': 1295, 'n_tokens_neox': 1219, 'n_words': 483}