Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- echo "nhap thu muc thu nhat: "
- read dir1
- echo "nhap thu muc thu 2: "
- read dir2
- if test ! -d $dir1
- then
- echo "thu muc "$dir1" khong ton tai"
- fi
- if test ! -d $dir2
- then
- echo "thu muc "$dir2" khong ton tai"
- fi
- if [ -d $dir1 ] && [ -d $dir2 ]
- then
- ls -l $dir1 | awk '$1 != "total" {print $1,$9}' | while read output
- do
- array=($output)
- if [ ${array[0]:0:1} == '-' ]
- then
- if [ -f $dir2"/"${array[1]} ]
- then
- rm -f $dir1"/"${array[1]}
- fi
- fi
- done
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement