From: Aaron Brady Date: Sun, 15 Jan 2012 13:16:37 +0000 (+0000) Subject: Migration: Ensure destination directories exist when moving RRDs X-Git-Tag: collectd-5.0.2~3^2 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=b3bb5e85375bae10ea5d6ff5c205a069d5d26654;p=collectd.git Migration: Ensure destination directories exist when moving RRDs If you have not run collectd 5 before, then when type instances are migrated to plugin instances the destination directories may not already exist. For example: mv "./test/df/df-mnt-dlna.rrd" "./test/df-mnt-dlna/df.rrd" This one-liner does a mkdir -p of the destination before attempting to move the file. --- diff --git a/contrib/migrate-4-5.px b/contrib/migrate-4-5.px index 539eaa33..d3ff796d 100755 --- a/contrib/migrate-4-5.px +++ b/contrib/migrate-4-5.px @@ -183,6 +183,7 @@ sub handle_file # {{{ && (!$plugin_inst) && ($type_inst)) { my $dir = join ('/', @path); + print "mkdir -p \"$dir/$plugin-$type_inst\"\n"; print "mv \"$path\" \"$dir/$plugin-$type_inst/$type.rrd\"\n"; } } # }}} sub handle_file