From a6051b6ac0c5dff3514067af55425aea7acd1aa8 Mon Sep 17 00:00:00 2001 From: Stefan `Sec` Zehl Date: Mon, 2 Jan 2012 20:37:46 +0100 Subject: [PATCH] Whoops. Forgot to add this perl script :-/ --- tools/smartflash/copy-files-ordered | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100755 tools/smartflash/copy-files-ordered diff --git a/tools/smartflash/copy-files-ordered b/tools/smartflash/copy-files-ordered new file mode 100755 index 0000000..0e0ce78 --- /dev/null +++ b/tools/smartflash/copy-files-ordered @@ -0,0 +1,28 @@ +#!/usr/bin/perl + +use strict; + +my($src,$dst,@files)=@ARGV; +my %allfiles; + +my $dh; + +opendir($dh, $src) || die "source dir missing"; +%allfiles=map {$_ => 1} grep {/^[^.]/} readdir($dh); +close $dh; + +my @dwim; +for (@files){ + if(!$allfiles{$_}){ + warn "$_ not found in $src\n"; + }else{ + push @dwim,$_; + }; +}; + +for (sort keys %allfiles){ + push @dwim,$_; +}; + +system("cp",(map {$src."/".$_} @dwim),$dst); +