linux下挂载fat32格式的存贮设备不能创建大写文件夹或者磁盘中的原来的大写文件夹变成小写

公司的一个项目需要做文件浏览器,有创建文件夹和重命名文件的功能,测试的时候发现了一些问题,主要针对的是FAT32格式的SD卡或U盘。

在Linux下挂载SD卡,用的命令是:

mount -t vfat /dev/mmcblk0p1 /mnt/sdcard/

然后出现了一下现象:

1、所有原先在WINDOWS上全部是大写的文件夹全部变为小写了;

2、在Linux上创建大写文件夹,结果也全部变为了小写。

然后查找资料,发现mount命令的shortname参数决定是否区分大小写。

以以下命令进行挂载,全部问题都解决了。

mount -t vfat -o shortname=mixed /dev/mmcblk0p1 /mnt/sdcard/

下面附上shortname参数可以取的值:

Linux下Mount函数的挂载:

shortname参数 决定了文件系统中是否 区分 英文大小写.

shortname={lower|win95|winnt|mixed}

Defines the behaviour for creation and display of filenames
which fit into 8.3 characters. If a long name for a file exists,
it will always be preferred display. There are four modes: :

lower Force the short name to lower case upon display; store a
long name when the short name is not all upper case. This
mode is the default.

win95 Force the short name to upper case upon display; store a
long name when the short name is not all upper case.

winnt Display the shortname as is; store a long name when the
short name is not all lower case or all upper case.

mixed Display the short name as is; store a long name when the
short name is not all upper case.



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值