由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Linux版 - ask one command in ubuntu
相关主题
linux如何生成可执行文件?substring 的问题
ubuntu下怎么sync and backup files ?Ubuntu下的VPN
linux菜鸟一问how to send an email in command line?
A question about two linux commands写了修改文件名的script
能MV/CP但不能执行求助:为什么ubuntu下面的gcc不能用呢? (转载)
问个基础问题,关于linux command存放地址有人能推荐和分享Ubuntu的入门书么?
ubuntu里怎么回复default字体/appearance求:gcc 4.6.1不兼容 ubuntu 11.10
Ubuntu 下 foreach(`ls -d xxx`) 不能work新人求入门书或者网站
相关话题的讨论汇总
话题: f2话题: f1话题: files话题: directory话题: command
进入Linux版参与讨论
1 (共1页)
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.

1 (共1页)
进入Linux版参与讨论
相关主题
新人求入门书或者网站能MV/CP但不能执行
root file system 和kernel有什么不一样吗?问个基础问题,关于linux command存放地址
数据copy之后,有些照片文件不能viewubuntu里怎么回复default字体/appearance
什么file server 值得推荐? (转载)Ubuntu 下 foreach(`ls -d xxx`) 不能work
linux如何生成可执行文件?substring 的问题
ubuntu下怎么sync and backup files ?Ubuntu下的VPN
linux菜鸟一问how to send an email in command line?
A question about two linux commands写了修改文件名的script
相关话题的讨论汇总
话题: f2话题: f1话题: files话题: directory话题: command