Created
March 2, 2013 13:55
-
-
Save jreisinger/5071103 to your computer and use it in GitHub Desktop.
Change mtime of files so they sort on TV
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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