g****n 发帖数: 3313 | 1 this is my code, but dosent work, ai........
#!/bin.sh
echo -n "Please enter dirA: " && read dirA
echo -n "Please enter dirB: " && read dirB
cd /dirA
for i in `ls`
do
if [ if ../dirB/$i]
then
#do nothing because I want to know the non-existing files
present=1
else
echo "dirA/"$i file is missing
ls -l $i >> /tmp/size_of_the_impacted_files
fi
cd /dirB
for i in `ls`
do
if [ if ../dirA/$i]
then
#do nothing because I want to know the non-existing files
present=1
else
echo "dirB/"$i file is missing
ls |
|
s*******r 发帖数: 3 | 2 Hi,
I made a "diff" to a directory and can't do a "patch" now.
What I did was:
diff -ruN dira dirb
"dira" and "dirb" are directory names. Then I deleted
"dirb".
Now, I have "dira" and want to generate "dirb". How can I
do it ?
Thanks!!! |
|
f*********e 发帖数: 8453 | 3 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 |
|
g****n 发帖数: 3313 | 4 谢谢!
我说不WORK那。。。。
还有,read dirA dirB以后,
后面怎么理由输入的数值那? 输入的dirA 变成了$1?
那么是否可以这么写: if [ if $1/$i] |
|
f*********e 发帖数: 8453 | 5 for f1 in $(ls dirA); do if [ -f dirA/$f1 ];then mv dirA/$f1 dirB;fi; done
better test before you run this on your real target |
|
s**********i 发帖数: 711 | 6
you need to add user B and set it to deny for DirA.
vice versa for DirB. |
|