你好,游客 登录 注册 搜索
背景:
阅读新闻

Ubuntu与XP共享文件夹方式下的文件复制脚本

[日期:2012-12-09] 来源:Linux社区  作者:szkbsgy [字体: ]

#此脚本用于在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/"

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

linux
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款