Re: [SLE] Files modified while copying from USB-card
- From: Rikard Johnels <rikard.j@xxxxxxxxxx>
- Date: Wed, 21 Jun 2006 00:06:03 +0200
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
- Follow-Ups:
- Re: [SLE] Files modified while copying from USB-card
- From: Rikard Johnels
- Re: [SLE] Files modified while copying from USB-card
- References:
- [SLE] Files modified while copying from USB-card
- From: Rikard Johnels
- Re: [SLE] Files modified while copying from USB-card
- From: Darryl Gregorash
- [SLE] Files modified while copying from USB-card
- Prev by Date: Re: [SLE] Crossover and Picasa
- Next by Date: Re: [SLE] Crossover and Picasa
- Previous by thread: Re: [SLE] Files modified while copying from USB-card
- Next by thread: Re: [SLE] Files modified while copying from USB-card
- Index(es):
Relevant Pages
|