公司的一个项目需要做文件浏览器,有创建文件夹和重命名文件的功能,测试的时候发现了一些问题,主要针对的是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.
5731

被折叠的 条评论
为什么被折叠?



