您的位置:首页 > 其它

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

2012-12-09 17:21 134 查看
#此脚本用于在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/"

#注:运行脚本需要以超级用户权限运行
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: