- 论坛徽章:
- 0
|
[Shell/批处理]代码- #!/bin/bash
- #rsync the hard disk files to usb disks
- #usage: UDF2HDrsync USBDISKNAME
- #example: UDF2HDrsync sdb1
- #the usb disk mount point is ${upath}
- #usb device
- if [ $# -ne 1 ]
- then
- echo Usage: $(basename $0) USBDISKNAME
- echo example: $(basename $0) sdb1
- exit
- fi
- udevice="/dev/$1"
- #usb disk mount point
- upath=$(mktemp -d -t usbdisk229_XXXXXX)'/'
- hpath='/media/sda2/'
- #source files
- sf=("${upath}lsoftware/" "${upath}software/" "${upath}docs/" "${upath}iso/slconfig/" "${upath}fp/")
- #destination files
- df=("${hpath}lsoftware/" "${hpath}software/" "${hpath}document/" "${hpath}ghost/iso/slconfig/" "/home/000/Documents/fp/")
- #mount ${udvice} on ${upath}
- sudo umount ${udevice} 2> /dev/null
- sudo mount ${udevice} ${upath}
- clear
- #rsync the files
- #full rsync
- for i in {0,1,2,3,4}
- #partial rsync
- #for i in {3,4}
- do
- echo ${sf[i]} '======>>>>>>' ${df[i]}
- #--exclude='*.bak'
- rsync\
- --specials --partial --delete --links\
- --recursive --times --update --verbose\
- --progress --human-readable\
- --exclude ".0/"\
- --exclude "vimPUNDO/"\
- --exclude "*.iso"\
- --exclude "*.mkv"\
- ${sf[i]} ${df[i]}
- done
- #umount ${udvice}
- sudo umount ${udevice}
- rm -rf ${upath}
- #===========================================================================
- #!/bin/bash
- #rsync the hard disk files to usb disks
- #usage: HDF2UDrsync USBDISKNAME
- #example: HDF2UDrsync sdb1
- #the usb disk mount point is ${upath}
- #usb device
- if [ $# -ne 1 ]
- then
- echo Usage: $(basename $0) USBDISKNAME
- echo example: $(basename $0) sdb1
- exit
- fi
- udevice="/dev/$1"
- #usb disk mount point
- upath=$(mktemp -d -t usbdisk229_XXXXXX)'/'
- hpath='/media/sda2/'
- #source files
- sf=("${hpath}lsoftware/" "${hpath}software/" "${hpath}document/" "${hpath}ghost/iso/slconfig/" "/home/000/Documents/fp/")
- #destination files
- df=("${upath}lsoftware/" "${upath}software/" "${upath}docs/" "${upath}iso/slconfig/" "${upath}fp/")
- #mount ${udvice} on ${upath}
- sudo umount ${udevice} 2> /dev/null
- sudo mount ${udevice} ${upath}
- clear
- #rsync the files
- #full rsync
- for i in {0,1,2,3,4}
- #partial rsync
- #for i in {3,4}
- do
- echo ${sf[i]} '======>>>>>>' ${df[i]}
- #--exclude='*.bak'
- rsync\
- --specials --partial --delete --links\
- --recursive --times --update --verbose\
- --progress --human-readable\
- --exclude ".0/"\
- --exclude "vimPUNDO/"\
- --exclude "*.iso"\
- --exclude "*.mkv"\
- ${sf[i]} ${df[i]}
- done
- #umount ${udvice}
- sudo umount ${udevice}
- rm -rf ${upath}
复制代码 |
|