bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: --preserve (cp is still changing file?)


From: The Batterson's
Subject: Re: --preserve (cp is still changing file?)
Date: Sat, 25 Mar 2006 16:27:49 -0500
User-agent: Mozilla Thunderbird 1.0.7 (X11/20051013)

Thank you for responding so quickly as I cannot say the same. I was able to use the mv command in place of the cp command. The mv command didn't effect the file, therefor rsync didn't write over the file in the destination directory. When I would use cp files to a new directory and then use cp to copy the files back to the original directory and then rsync the files to a flash drive the problem would occur. Rsync would write over the existing file on the flash drive even though the files were the same. So for some reason cp would modify or change the file. I used the mv command to move files back and forth between directories and then rsynced the files to the flash drive and it worked fine.

Here's the script that has been working for me:

# KFI Tech Guy
ls -t ~/iPodderData/downloads/'KFI Tech Guy' | head -2 | xargs -i mv ~/iPodderData/downloads/'KFI Tech Guy'/{} ~/iPodderData/downloads/temp/{}
rm ~/iPodderData/downloads/'KFI Tech Guy'/*
mv ~/iPodderData/downloads/temp/* ~/iPodderData/downloads/'KFI Tech Guy'/
rsync -a --progress --delete ~/iPodderData/downloads/'KFI Tech Guy'/ /media/usbdisk/Podcasts/'KFI Tech Guy'/

Sincerely,
Miles Batterson
Saline, MI USA






Bob Proulx wrote:

The Batterson's wrote:
The preserve function isn't working properly.

Thank you for your report.  But in order to understand the problem you
are having we need more information.  The preserve function is working
for me and must also be working for many other people otherwise we
would have more bug reports about it.

What version of cp from coreutils are you using?  Use --version to
determine this.

 cp --version

What operating system are you using?  Usually uname -a helps here.

 uname -a

What filesystems are involved?  The 'df -T' command may be useful
here.

 df -T .

rsync copies over the existing file even though it's the same file.

The default for rsync is that if the file timestamp and size match
then it will assume the files are the same.

Is cp changing something even though I have --preserve?  It doesn't
seem to be preserving the time stamp.

If you would look at the file size, timestamp and contents after the
copy and verify that the file either is or is not the same after the
copy that is the information needed.

 ls -ld somefile
 cp -p somefile someotherfile
 ls -ld someotherfile

Please see the script below.

# KFI Tech Guy
ls -t ~/iPodderData/downloads/'KFI Tech Guy' | head -2 | xargs -i cp -v --preserve ~/iPodderData/downloads/'KFI Tech Guy'/{} ~/iPodderData/downloads/temp/{}
rm ~/iPodderData/downloads/'KFI Tech Guy'/*
cp -v --preserve ~/iPodderData/downloads/temp/* ~/iPodderData/downloads/'KFI Tech Guy'/ rsync -a --progress --delete ~/iPodderData/downloads/'KFI Tech Guy'/ /media/usbdisk/Podcasts/'KFI Tech Guy'/
rm ~/iPodderData/downloads/temp/*

Unfortunately your script does not illustrate any problems to me.  It
is just a series of commands with no results of those commands.

Bob




reply via email to

[Prev in Thread] Current Thread [Next in Thread]