Re: [SLE] Files modified while copying from USB-card



On Tuesday 20 June 2006 23:30, Darryl Gregorash wrote:
On 20/06/06 14:42, Rikard Johnels wrote:
Hello all!
I have this script that copies all files from my digital camera into a new
folder upon execution.
But now and again (Not always) i get an error like:

cp: skipping file `/media/usbdisk/dcim/100pentx/imgp0099.jpg', as it was
replaced while being copied

The card is automounted and not touched while the script is ran.
So why is the filesystem on the card touched and (apparently) changed?

That error message, as cryptic as it is, seems more like what you'd get
if the file already exists in the destination, and cp was run without
the -f (force) option.

--
Check the headers for your unsubscription address
For additional commands send e-mail to suse-linux-e-help@xxxxxxxx
Also check the archives at http://lists.suse.com
Please read the FAQs: suse-linux-e-faq@xxxxxxxx

I doesn't.
The destination is freshly made at each pass by the script.
It creates a folder 'yymmdd.xx' where 'xx' is an incremented sequential
number. So if i run the script twice the same date, it still differs by the
last two digits (01,02 etc).
So it CAN'T find anything in the target. (Or at least shouldn't)

The script is as follows for those who want to debug:
maybe not very intelligent or pretty regarding code, but it runs :)
(Bits and pieces from helpful ppl here on the list...)


-- cut --

#!/usr/bin/perl
use strict;
use warnings;
use File::Path;

my $dst_dir = "/mnt/network/dual/hdc/Pictures";

my $src_dir;
for(1..10){
{
open my $in,"/proc/mounts" or die "$!\n";
$/=undef;
($src_dir) = <$in>=~/ (\S*usbdisk\S*)/;

close $in;
}
last if defined $src_dir;
sleep 2;
}

die "Could not calculate \$src_dir" unless defined $src_dir;
my @time = localtime(time);

my( $year ) = $time[5]=~/(\d\d)$/;
my $month = $time[4]+1;
$month="0$month" if $month<10;
my $day = $time[3];
$day="0$day" if $day<10;

$dst_dir.="/$year/$month/$year$month$day";

my $xx="01";
while( -d "$dst_dir.$xx" ){
$xx++;
}
$dst_dir.=".$xx";

mkdir $dst_dir or die "$!\n";
mkpath($dst_dir);
`cp -r $src_dir/dcim/100pentx/* $dst_dir/`;

-- uncut --


--
         /Rikard

-----------------------------------------------------------------------------
email   : rikard.j@xxxxxxxxxx
web     : http://www.rikjoh.com
mob: : +46 (0)763 19 76 25
------------------------ Public PGP fingerprint ----------------------------
< 15 28 DF 78 67 98 B2 16 1F D3 FD C5 59 D4 B6 78  46 1C EE 56 >

Attachment: pgpxWk7NdAYdP.pgp
Description: PGP signature



Relevant Pages

  • [kde] Re: plasma-desktop (KDE factory) acting up?
    ... example is another logging plasmoid that shows the output of a little ... script that outputs the state of my four drives every ten seconds. ... I have the group set to wheel for the logs I want to be read by trusted ... folder with pictures of people, and a subfolder with pictures of myself. ...
    (KDE)
  • Re: User account and Personal folder mismatch script
    ... I believe you want a script that can be run by an administrator that will ... The script above only documents if a home folder has been assigned. ... > End Sub ...
    (microsoft.public.scripting.vbscript)
  • Input on CleanUp script
    ... Since I'm going to be using this script in a production environment, ... If the script is used with a backup folder ... var strTargetFolder, strBackupFolder, args0, args1, args2, noArgs; ...
    (microsoft.public.scripting.jscript)
  • Re: Disappearing Links
    ... I believe someone has a script for rebuilding links but I'm unable to find it at the moment. ... It could be adapted to trawl through the whole mail folder tree - if you really need that, ... -- to any contacts in the address book that match the sender of the messages ... set theSelection to selection ...
    (microsoft.public.mac.office.entourage)
  • Input on CleanUp script
    ... Since I'm going to be using this script in a production environment, ... If the script is used with a backup folder ... var strTargetFolder, strBackupFolder, args0, args1, args2, noArgs; ...
    (microsoft.public.scripting.wsh)