Способ 1:с использованием./
rm -f./'file name'
иrm -f./'file*name'
Способ 2:с использованием inode:
Получить индекс изls
ls -i "file name"
, затем
find. -inum "numberoofinode" -exec rm {} \;
Перл-версия утилиты rename
может это сделать (есть еще одна программа под названием rename
, которая является частью util-linux
пакета ). Пример:
$ touch '1_this is_file one-xhdjsnsk.mp4' '2_this_is file two-hdksbdg.mp4' '3_this is_file three-hsislnsm.mp4' '4_this is file four-gwywkkd.mp4'
$ ls -l
total 0
-rw-r--r-- 1 ja users 0 Feb 24 12:43 1_this is_file one-xhdjsnsk.mp4
-rw-r--r-- 1 ja users 0 Feb 24 12:43 2_this_is file two-hdksbdg.mp4
-rw-r--r-- 1 ja users 0 Feb 24 12:43 3_this is_file three-hsislnsm.mp4
-rw-r--r-- 1 ja users 0 Feb 24 12:43 4_this is file four-gwywkkd.mp4
$ perl-rename 's,\-.+\.,.,' *
$ ls -l
total 0
-rw-r--r-- 1 ja users 0 Feb 24 12:43 1_this is_file one.mp4
-rw-r--r-- 1 ja users 0 Feb 24 12:43 2_this_is file two.mp4
-rw-r--r-- 1 ja users 0 Feb 24 12:43 3_this is_file three.mp4
-rw-r--r-- 1 ja users 0 Feb 24 12:43 4_this is file four.mp4
Программаrename
может иметь другое имя в вашей системе, например, в Ubuntu это file-rename
.