
운영체제: 쿠분투 22.04.4 LTS x86_64
디톡스 1.4.5
위에 표시하려면:
neofetch --stdout |grep 'OS:'
detox -V
다음은 s1로 시작하는 유해한 파일 이름입니다.
s1 Ä Ö Ü - ä ö ü Science & < > " 1 \ 2 ⁄ 3 | ? * (&&9&&&) ::::z.pdf
script1
복사해서 터미널에 붙여넣었습니다.
script1
출력은 위의 독성 파일 이름에서 작동합니다 "$FILE1"
.
filename_before_detox='s1 Ä Ö Ü - ä ö ü Science & < > " 1 \ 2 ⁄ 3 | ? * (&&9&&&) ::::z.pdf'
filename_after__detox= s1_A_A-Aoe-A_A_pp_A_Science_and_1_2_a_3-and_and_9_and_and_and-z.pdf
script1
작동하여 해독된 파일 이름이 생성됩니다. 공백 및 특수 문자 없음: 아래에서 원하는 변환, 이름 변경, 파일 이름을 참조하세요.
s1_A_A-Aoe-A_A_pp_A_Science_and_1_2_a_3-and_and_9_and_and_and-z.pdf
script1
:
clear
DIR1=$HOME/Downloads # DIR1=/home/x/Downloads
cd $DIR1
ls -alF s1* # List all filenames starting with s1
FILE1='s1 Ä Ö Ü - ä ö ü Science & < > " 1 \ 2 ⁄ 3 | ? * (&&9&&&) ::::z.pdf'
detox -s iso8859_1 "$FILE1"
# detox -s iso8859_1 -v "$FILE1" # v=verbose
ls -alF s1* # List all filenames starting with s1
script2
작동 안됨:
오류 = 해당 파일이나 디렉터리가 없습니다
script2
자동으로 새 파일을 감지하고 DIR1 = ~/Downloads
On script2
Access 상태가 되면 테스트 중에 바이러스에 대한 클램스캔을 DIR1
실행하게 되며 다운로드를 시뮬레이션하기 위해 수동으로 붙여넣습니다 .FILE1
DIR1
다양한 인용 결과:
detox -s iso8859_1 "$FILE1" # No such file or directory
detox -s iso8859_1 '"$FILE1"' # No such file or directory
detox -s iso8859_1 ""$FILE1"" # posting errors then ok result
script2
clear
DIR1=$HOME/Downloads # DIR1=/home/x/Downloads
inotifywait -q -m -e close_write,moved_to --format '%w%f' "$DIR1" |while read FILE1
do
ls -alF s1* # List all filenames starting with s1
detox -s iso8859_1 ""$FILE1""
ls -alF s1* # List all filenames starting with s1
done
script2
오류가 있지만 결과는 괜찮습니다.
s1_A_A-Aoe-A_A_pp_A_Science_and_1_2_a_3-and_and_9_and_and_and-z.pdf
그러나 많은 오류가 있습니다:
rw-rw-r-- 1 x x 1153263 Mar 13 11:36 's1 Ä Ö Ü - ä ö ü Science & < > " 1 \ 2 ⁄ 3 | ? * (&&9&&&) ::::z.pdf'
/home/x/Downloads/s1: No such file or directory
Ä: No such file or directory
Ö: No such file or directory
Ü: No such file or directory
-: No such file or directory
ä: No such file or directory
ö: No such file or directory
ü: No such file or directory
Science: No such file or directory
&: No such file or directory
<: No such file or directory
>: No such file or directory
": No such file or directory
2: No such file or directory
⁄: No such file or directory
3: No such file or directory
|: No such file or directory
(&&9&&&): No such file or directory
::::z.pdf: No such file or directory
-rw-rw-r-- 1 x x 1153263 Mar 13 11:36 s1_A_A-Aoe-A_A_pp_A_Science_and_1_2_a_3-and_and_9_and_and_and-z.pdf
-rw-rw-r-- 1 x x 1153263 Mar 13 11:36 s1_A_A-Aoe-A_A_pp_A_Science_and_1_2_a_3-and_and_9_and_and_and-z.pdf
-rw-rw-r-- 1 x x 1153263 Mar 13 11:36 s1_A_A-Aoe-A_A_pp_A_Science_and_1_2_a_3-and_and_9_and_and_and-z.pdf
무슨 detox
뜻인가요?
detox
= 파일 이름 정리- 이
detox
유틸리티는 작업하기 쉽게 파일 이름을 바꿉니다
. - 공백 및 기타 성가심을 제거합니다.
- 또한 8비트 ASCII로 인코딩된 Latin-1(ISO 8859-1) 문자, UTF-8로 인코딩된 유니코드 문자 및 CGI 이스케이프 문자를 변환하거나 정리합니다.
inotifywait
= inotify를 사용하여 파일 변경을 기다립니다.
inotifywait
Linux 인터페이스를 사용하여 파일 변경을 효율적으로 기다립니다inotify(7)
.- 쉘 스크립트에서 파일 변경을 기다리는 데 적합합니다.
- 이벤트가 발생하면 종료하거나 이벤트가 발생할 때마다 계속해서 실행하고 출력할 수 있습니다.
오류가 게시되지 않고 bash 스크립트에서 파일 이름을 해독하는 방법은 무엇입니까?