Mailinglist Archive: opensuse (2459 mails)

< Previous Next >
Re: [opensuse] mv and cpio have new behavior. How do I get the old back?
  • From: Sam Clemens <clemens.sam1@xxxxxxxxx>
  • Date: Tue, 25 Mar 2008 18:00:41 -0400
  • Message-id: <47E97609.8010806@xxxxxxxxx>
Boyd Lynn Gerber wrote:
On Tue, 25 Mar 2008, Per Jessen wrote:
Boyd Lynn Gerber wrote:
Both, but I am mainly using the xfs. I have a lot of small files.
The files themselves keep their times, but the directories all change.

I don't know if that's new, but it seems reasonable for the directory to
change timestamp when the contents of the directoy changes.

I do not mind the timestamp changing on the directory the files are moved
into, but to change the timestamp on all directories of the moved
directory and below should not change. After all, all I want is to move
the directory to a different directory.

I used the timestamp as a method of telling when the files within were
created. This makes it really hard to tell what really is in the
directory. I have source code from 1996. When the timestamp changes it
makes me think I have changed something in the directory. I really have
not. It makes keeping track of things a lot hard. I did not notice the
timestamp change till I was looking for the differences between my working
directory and the orignal. I could not tell which was which when the
timestamps changed. It is making my development a lot harder.


Until this gets solved, use the script below:
(put it in ~/bin, chmod it to 755, and set your PATH
to make sure ~/bin preceeds /bin). To use the regular
mv, type the path /bin/mv.

#!/bin/bash
##################################################################
#
# mv move targets and preserve owner, mode, and timestamps
#
# usage: mv src [src1 ...] dest
#
# date Name Action
# ----------- ----------------- ------------------------
# 25 Mar 2008 ARK Origination
#
##################################################################

DEBUG=1 # 0 = on, non-zero = off

CP=/bin/cp
CPFLAGS="-p -R"
STDERR=/proc/self/fd/2

ARGCOUNT=$#

if [ $ARGCOUNT -lt 2 ]
then
PID=$$
echo ${0}: usage: ${0} src [src1 ... ] dest > $STDERR
exit 1
fi

# DEST=$!$ARGCOUNT # doesn't work
DEST=$BASH_ARGV # DEST=${[$ARGCOUNT]} doesn't get last param
if [[ $DEBUG -eq 0 ]] ; then echo $DEST > $STDERR ; fi

while [ $ARGCOUNT -gt 1 ]
do
## execute the rm ONLY if the copy succeeds without error
${CP} ${CPFLAGS} $1 ${DEST} && rm -rf $1

shift # advance to next arg
(( ARGCOUNT -= 1 ))
# echo $ARGCOUNT > $STDERR
done








--
Boyd Gerber <gerberb@xxxxxxxxx>
ZENEZ 1042 East Fort Union #135, Midvale Utah 84047

--
To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse+help@xxxxxxxxxxxx

< Previous Next >