diff options
Diffstat (limited to 'cron/read_filesize_from_filesystem.pl')
-rwxr-xr-x | cron/read_filesize_from_filesystem.pl | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/cron/read_filesize_from_filesystem.pl b/cron/read_filesize_from_filesystem.pl new file mode 100755 index 0000000..702ddb4 --- /dev/null +++ b/cron/read_filesize_from_filesystem.pl @@ -0,0 +1,16 @@ +#!/usr/bin/perl +use strict; +use Cwd 'abs_path'; +use File::Basename; +use local::db; +use config; + +for my $dl (local::db::download->retrieve_all) +{ + my $du = "du -sm ".$config::config{files_dir}.'/'.$dl->category->name.'/'.$dl->download_id; + my $du_resp = `$du`; + my ($size) = $du_resp =~ /^(\d+)/; + # warn $size; + $dl->size($size); + $dl->update; +} |