我有一个包含以下目录的文件夹
$ pwd
/d/xxx
'Anupam Roy - Zulfiqar (Original Motion Picture Soundtrack)'/
'Zulm Ka Jawab [1995] [Soundtrack]{Original Release Melody Top Star MCD No. 406 CD}'/
第一个目录包含扩展名为.flac的文件的列表 第二个目录有一个名为
的另一个文件夹'Bappi Lahiri - Zulm Ka Jawab (1995) [FLAC] {Melody MCD-406}'/
我的要求是循环遍历/ d / xxx中的所有目录,并将它们移动到另一个位置。如果目录中有flac文件,我想跳过该目录。
在这种情况下,我要移动“ Bappi Lahiri-Zulm Ka Jawab(1995)[FLAC] {Melody MCD-406}” /,并跳过“ Anupam Roy-Zulfiqar(原始电影原声带)” /
我有一个脚本,但是由于目录名带有空格而无法正常工作
#!/bin/bash
for d in D:/xxx/*/; do
count=`ls -l *.flac 2>/dev/null | wc -l`
if [ -d "$d" ] && [ $count == 0 ]; then
mv $d D:/krishna/
#$echo "$d"
fi
done
答案 0 :(得分:0)
我现在稍微修改了脚本,然后从D:\ xxx运行脚本。
#!/bin/bash
for d in */; do
echo $d
cd "$d"
count=`ls -l *.flac 2>/dev/null | wc -l`
cd ..
echo $count
if [ -d "$d" ] && [ $count == 0 ]; then
mv $d D:/krishna/
#$echo "$d"
fi
done
但这给了错误
$ ./dcdcopy.sh
Anupam Roy - Zulfiqar (Original Motion Picture Soundtrack)/
6
Zulm Ka Jawab [1995] [Soundtrack]{Original Release Melody Top Star MCD No. 406 CD}/
0
mv: cannot stat 'Zulm': No such file or directory
mv: cannot stat 'Ka': No such file or directory
mv: cannot stat 'Jawab': No such file or directory
mv: cannot stat '[1995]': No such file or directory
mv: cannot stat '[Soundtrack]{Original': No such file or directory
mv: cannot stat 'Release': No such file or directory
mv: cannot stat 'Melody': No such file or directory
mv: cannot stat 'Top': No such file or directory
mv: cannot stat 'Star': No such file or directory
mv: cannot stat 'MCD': No such file or directory
mv: cannot stat 'No.': No such file or directory
mv: cannot stat '406': No such file or directory
mv: cannot stat 'CD}/': No such file or directory
答案 1 :(得分:0)
让它正常工作
clazz.getDeclaredMethod