读书人

ubuntu与xp共享文件夹方式上的文件复制

发布时间: 2012-12-15 15:16:03 作者: rapoo

ubuntu与xp共享文件夹方式下的文件复制脚本

#此脚本用于在ubuntu环境下拷贝一个文件到共享文件夹中

#contiki_Share为共享文件夹的名字

#!/bin/sh
#function:cp a file(such as xx.hex) to /mnt/hgfs/contiki_Share that is the shared directory
# between xp and vmware ubuntu
#file name: file_cp.sh
#date: 2012-07-29

#example:

#使用方法:file_cp.sh file_name

#parameter detection;检测是否为一个参数(参数为要拷贝的文件)
if [ $# -ne 1 ]
then
echo "ERROR:there mush be one parameter"
exit
fi

#dir detection;

#共享目录检测,用于检测在ubuntu是否存在共享目录,如不存在,则挂载
if [ -d /mnt/hgfs/contiki_Share ]
then
echo "dir contiki_Share exist"
else
sudo mount -t vmhgfs .host:/ /mnt/hgfs
fi


echo "$1"
sudo cp ./"$1" /mnt/hgfs/contiki_Share/
echo "$1 has been copied to /mnt/hgfs/contiki_Share/"

#注:运行脚本需要以超级用户权限运行

读书人网 >编程

热点推荐