Skip to content

Instantly share code, notes, and snippets.

@jreisinger
Created March 2, 2013 13:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jreisinger/5071103 to your computer and use it in GitHub Desktop.
Save jreisinger/5071103 to your computer and use it in GitHub Desktop.
Change mtime of files so they sort on TV
#!/usr/bin/perl
# Change mtime of files so they sort on TV.
use strict;
use warnings;
use 5.010;
use File::Find;
die "Usage: $0 <dir(s)>\n" unless @ARGV;
my @files;
find( sub { push @files, $File::Find::name }, @ARGV );
my $month = 1;
my $day = 1;
for ( sort @files ) { # sort ASCIIbetically
next if /$0/; # don't change myself
system "touch", "--date=2000-$month-$day", "$_";
if ( $day > 27 ){ # don't mess up the number of days in month
$day = 1;
$month++;
} else {
$day++;
}
}
print "You should rebuild miniDLNA DB: sudo service minidlna force-reload\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment