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@suse.com Also check the archives at http://lists.suse.com Please read the FAQs: suse-linux-e-faq@suse.com
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@rikjoh.com 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 >