处理linux乱码文件
情景:小姑娘不能直接在文件服务器上播放swf文件。swf所在的文件夹是以一个心形的字符命名的。命名吃文件夹的童鞋很有水平。首先想到是权限的问题,可到文件服务器上,找不到那个文件。急呀。
方法 目录下看到都是乱码,此时可以用find的inum选项。find还有这么一个选项,以前没用过哦。linux下,任何一个文件或文件夹inum都是唯一的
尝试直接进入,失败,怪事
Usage: find [path...] [expression]
[root@ct-test demo]# find -inum 15728645 -exec cd {} \;
find: cd: No such file or directory
[root@ct-test demo]# find . -inum 15728645 -exec cd {} \;
find: cd: No such file or directory
查找,并重命名。报错了,事实上,已重命名
[root@ct-test demo]# find . -inum 15728645 -exec mv {} hli1 \;
find: ./鉂? No such file or directory
[root@ct-test demo]# ll -i
total 728
182634 drwxrwxrwx 4 staff staff 4096 Nov 18 12:31 4.02
182480 drwxrwxrwx 5 staff staff 4096 Nov 18 12:31 5.24
182406 drwxrwxrwx 6 staff staff 4096 Nov 18 12:31 5.5
182324 drwxrwxrwx 2 staff staff 4096 Nov 18 12:31 8.03
182222 drwxrwxrwx 2 staff staff 4096 Nov 18 12:31 8.12
182038 drwxrwxrwx 4 staff staff 4096 Nov 18 12:31 8.26
181995 drwxrwxrwx 4 staff staff 4096 Nov 18 12:31 8.31
181942 drwxrwxrwx 4 staff staff 4096 Nov 18 12:31 9.9
181158 drwxrwxrwx 18 staff staff 4096 Nov 18 12:31 DEMO??????
180225 drwxrwxrwx 7 staff staff 4096 Nov 23 11:02 StormII
181101 drwxrwxrwx 4 staff staff 4096 Nov 18 12:30 demo??????
15728645 drwxrwxrwx 2 staff staff 4096 Dec 7 13:34 hli1
181010 drwxrwxrwx 3 staff staff 4096 Nov 18 12:30 myfiles_FlashCS3ls
180428 drwxrwxrwx 6 staff staff 4096 Nov 18 12:29 shopping
22219781 drwxrwxrwx 2 staff staff 262144 Nov 23 11:12 test
22216706 drwxrwxrwx 8 staff staff 4096 Nov 18 12:07 ?????????
21957937 drwxrwxrwx 2 staff staff 262144 Nov 22 13:03 ?????? test
21957743 drwxrwxrwx 8 staff staff 4096 Nov 18 10:49 ????????????
21956541 drwxrwxrwx 18 staff staff 4096 Nov 18 10:48 ???demo
[root@ct-test demo]# cd hli1
[root@ct-test hli1]# ll
total 20060
-rwxrwxrwx 1 staff staff 815223 Dec 5 13:37 ??????_????????????.swf
-rwxrwxrwx 1 staff staff 781047 Nov 21 15:00 ??????_????????????.swf
-rwxrwxrwx 1 staff staff 751507 Dec 2 17:05 ??????_?????????.swf
-rwxrwxrwx 1 staff staff 1186598 Nov 25 16:03 ????????????.swf
-rwxrwxrwx 1 staff staff 262277 Nov 25 16:08 ????????????_????????????.3gp
-rwxrwxrwx 1 staff staff 705827 Nov 30 09:50 ???????????????????????????.swf
-rwxrwxrwx 1 staff staff 854488 Nov 28 11:08 ??????_?????????.swf
-rwxrwxrwx 1 staff staff 459930 Nov 25 17:13 ??????_???????????????.swf
-rwxrwxrwx 1 staff staff 640083 Nov 28 20:23 ??????_????????????.swf
-rwxrwxrwx 1 staff staff 483220 Nov 18 14:34 ???????????????.swf
-rwxrwxrwx 1 staff staff 752115 Nov 22 18:16 ??????(??????)??????.swf
-rwxrwxrwx 1 staff staff 469767 Dec 5 18:17 ????????????_??????_??????????????????.swf
-rwxrwxrwx 1 staff staff 680044 Dec 5 18:18 ????????????_??????????????????.swf
-rwxrwxrwx 1 staff staff 269675 Dec 5 18:17 ????????????_???????????????.swf
-rwxrwxrwx 1 staff staff 73205 Dec 5 18:18 ????????????_????????????(?????????).swf
-rwxrwxrwx 1 staff staff 300976 Dec 5 18:18 ????????????_????????????.swf
-rwxrwxrwx 1 staff staff 333390 Dec 5 18:17 ????????????_???????????????.swf
-rwxrwxrwx 1 staff staff 260950 Dec 5 18:15 ????????????_??????-?????????.swf
-rwxrwxrwx 1 staff staff 180134 Dec 5 18:13 ????????????_??????_??????????????????.swf
-rwxrwxrwx 1 staff staff 274476 Dec 5 18:14 ????????????_??????_?????????????????????.swf
-rwxrwxrwx 1 staff staff 418289 Dec 5 18:14 ????????????_??????_????????????????????????.swf
-rwxrwxrwx 1 staff staff 288858 Dec 5 18:15 ????????????_??????_??????????????????.swf
-rwxrwxrwx 1 staff staff 375076 Dec 5 18:14 ????????????_??????_????????????.swf
-rwxrwxrwx 1 staff staff 119814 Dec 5 18:14 ????????????_??????_???????????????.swf
-rwxrwxrwx 1 staff staff 375467 Dec 5 18:14 ????????????_??????_????????????.swf
-rwxrwxrwx 1 staff staff 756283 Dec 5 18:15 ????????????_??????_????????????.swf
-rwxrwxrwx 1 staff staff 601179 Dec 5 18:14 ????????????_??????_?????????.swf
-rwxrwxrwx 1 staff staff 768193 Dec 5 18:14 ????????????_??????_??????????????????.swf
-rwxrwxrwx 1 staff staff 176202 Dec 5 18:15 ????????????_??????_?????????????????????.swf
[root@ct-test hli1]# cd ..
[root@ct-test demo]# ll -i
total 728
182480 drwxrwxrwx 5 staff staff 4096 Nov 18 12:31 5.24
182406 drwxrwxrwx 6 staff staff 4096 Nov 18 12:31 5.5
182324 drwxrwxrwx 2 staff staff 4096 Nov 18 12:31 8.03
182222 drwxrwxrwx 2 staff staff 4096 Nov 18 12:31 8.12
182038 drwxrwxrwx 4 staff staff 4096 Nov 18 12:31 8.26
181995 drwxrwxrwx 4 staff staff 4096 Nov 18 12:31 8.31
181942 drwxrwxrwx 4 staff staff 4096 Nov 18 12:31 9.9
181158 drwxrwxrwx 18 staff staff 4096 Nov 18 12:31 DEMO??????
180225 drwxrwxrwx 7 staff staff 4096 Nov 23 11:02 StormII
181101 drwxrwxrwx 4 staff staff 4096 Nov 18 12:30 demo??????
15728645 drwxrwxrwx 2 staff staff 4096 Dec 7 13:34 hli1
181010 drwxrwxrwx 3 staff staff 4096 Nov 18 12:30 myfiles_FlashCS3ls
180428 drwxrwxrwx 6 staff staff 4096 Nov 18 12:29 shopping
22219781 drwxrwxrwx 2 staff staff 262144 Nov 23 11:12 test
22216706 drwxrwxrwx 8 staff staff 4096 Nov 18 12:07 ?????????
21957937 drwxrwxrwx 2 staff staff 262144 Nov 22 13:03 ?????? test
21957743 drwxrwxrwx 8 staff staff 4096 Nov 18 10:49 ????????????
21956541 drwxrwxrwx 18 staff staff 4096 Nov 18 10:48 ???demo
[root@ct-test demo]# find . -inum 22216706 -exec mv {} hli2 \;
find: ./鍗婃垚鍝? No such file or directory
[root@ct-test demo]# find . -inum 21957937 -exec mv {} hli3 \;
find: ./澶嶄欢 test: No such file or directory
[root@ct-test demo]# find . -inum 21957743 -exec mv {} hli4 \;
find: ./鏁堟灉棰勮?: No such file or directory
[root@ct-test demo]# find . -inum 21956541 -exec mv {} hli5 \;
find: ./鏂癲emo: No such file or directory
[root@ct-test demo]# cd hli1
[root@ct-test hli1]# ll -i
total 20060
15728650 -rwxrwxrwx 1 staff staff 815223 Dec 5 13:37 ??????_????????????.swf
15728651 -rwxrwxrwx 1 staff staff 781047 Nov 21 15:00 ??????_????????????.swf
15728649 -rwxrwxrwx 1 staff staff 751507 Dec 2 17:05 ??????_?????????.swf
15728647 -rwxrwxrwx 1 staff staff 1186598 Nov 25 16:03 ????????????.swf
15728646 -rwxrwxrwx 1 staff staff 262277 Nov 25 16:08 ????????????_????????????.3gp
15728655 -rwxrwxrwx 1 staff staff 705827 Nov 30 09:50 ???????????????????????????.swf
15728654 -rwxrwxrwx 1 staff staff 854488 Nov 28 11:08 ??????_?????????.swf
15728652 -rwxrwxrwx 1 staff staff 459930 Nov 25 17:13 ??????_???????????????.swf
15728653 -rwxrwxrwx 1 staff staff 640083 Nov 28 20:23 ??????_????????????.swf
15728656 -rwxrwxrwx 1 staff staff 483220 Nov 18 14:34 ???????????????.swf
15728648 -rwxrwxrwx 1 staff staff 752115 Nov 22 18:16 ??????(??????)??????.swf
15728661 -rwxrwxrwx 1 staff staff 469767 Dec 5 18:17 ????????????_??????_??????????????????.swf
15728664 -rwxrwxrwx 1 staff staff 680044 Dec 5 18:18 ????????????_??????????????????.swf
15728662 -rwxrwxrwx 1 staff staff 269675 Dec 5 18:17 ????????????_???????????????.swf
15728666 -rwxrwxrwx 1 staff staff 73205 Dec 5 18:18 ????????????_????????????(?????????).swf
15728665 -rwxrwxrwx 1 staff staff 300976 Dec 5 18:18 ????????????_????????????.swf
15728663 -rwxrwxrwx 1 staff staff 333390 Dec 5 18:17 ????????????_???????????????.swf
15728681 -rwxrwxrwx 1 staff staff 260950 Dec 5 18:15 ????????????_??????-?????????.swf
15728667 -rwxrwxrwx 1 staff staff 180134 Dec 5 18:13 ????????????_??????_??????????????????.swf
15728668 -rwxrwxrwx 1 staff staff 274476 Dec 5 18:14 ????????????_??????_?????????????????????.swf
15728671 -rwxrwxrwx 1 staff staff 418289 Dec 5 18:14 ????????????_??????_????????????????????????.swf
15728675 -rwxrwxrwx 1 staff staff 288858 Dec 5 18:15 ????????????_??????_??????????????????.swf
[root@ct-test hli1]# cd ..
[root@ct-test demo]# ll -i
total 728
15728645 drwxrwxrwx 2 staff staff 4096 Dec 7 13:34 hli1
22216706 drwxrwxrwx 8 staff staff 4096 Nov 18 12:07 hli2
21957937 drwxrwxrwx 2 staff staff 262144 Nov 22 13:03 hli3
21957743 drwxrwxrwx 8 staff staff 4096 Nov 18 10:49 hli4
21956541 drwxrwxrwx 18 staff staff 4096 Nov 18 10:48 hli5
可以正常访问和读取啦。其实不是权限的问题,是找不到路径。一个以特殊字符命名的文件夹,不认识。
谢谢
阅读(1767) | 评论(0) | 转发(0) |