f******e 发帖数: 582 | 1 Using UbuntuI. have some files F1 under directory A. I have some other files
F2 under directory B. There are some overlap and difference between F1 and
F2.
Now, I want to copy all those files which are in F1 but not in F2 to another
directory. What can I do? Thanks a lot. |
G*****h 发帖数: 33134 | 2 move away the files in F2 set,
the remaining ones are not in F2 then.
files
and
another
【在 f******e 的大作中提到】 : Using UbuntuI. have some files F1 under directory A. I have some other files : F2 under directory B. There are some overlap and difference between F1 and : F2. : Now, I want to copy all those files which are in F1 but not in F2 to another : directory. What can I do? Thanks a lot.
|
I*****y 发帖数: 602 | 3 看看find,应该可以解决你的问题。
files
and
another
【在 f******e 的大作中提到】 : Using UbuntuI. have some files F1 under directory A. I have some other files : F2 under directory B. There are some overlap and difference between F1 and : F2. : Now, I want to copy all those files which are in F1 but not in F2 to another : directory. What can I do? Thanks a lot.
|
f*********e 发帖数: 8453 | 4 for f1 in $(ls dirA); do if [ ! -f dirB/$f1 ];then cp dirA/$f1 dirC;fi; done
better test first (won't work if you have sub dir. in your dirA and dirB).
pls make your target dir (dirC in the example) first before running the cmd
(works in bash shell):
files
and
another
【在 f******e 的大作中提到】 : Using UbuntuI. have some files F1 under directory A. I have some other files : F2 under directory B. There are some overlap and difference between F1 and : F2. : Now, I want to copy all those files which are in F1 but not in F2 to another : directory. What can I do? Thanks a lot.
|
c*****m 发帖数: 1160 | 5 copy F2 files of B into C
Copy F1 files of A into C, make sure not to replace existing files
Delete F2 files in C. |
d****n 发帖数: 1637 | 6 for i in F1/*
do
bname=`basename $i`
if [ ! -f F2/$bname ]
then
cp $i destination/
fi
done
files
and
another
【在 f******e 的大作中提到】 : Using UbuntuI. have some files F1 under directory A. I have some other files : F2 under directory B. There are some overlap and difference between F1 and : F2. : Now, I want to copy all those files which are in F1 but not in F2 to another : directory. What can I do? Thanks a lot.
|