2014-04-08 19 views
0
folder_name=(MI IG Chi-square) 
for m in {0..2} 
do 
    folder=${folder_name[$m]} 
    echo 
    echo $folder 
    echo 
    train_path="/home/user/Thesis/DVD/Features/Training/POSITIVE/$folder/Unigram/" 
    test_path="/home/user/Thesis/DVD/Features/Testing/POSITIVE/$folder/" 
    for f,k in $train_path $test_path 
    do 
     if $f in *.arff and $k in *.arff ; then 
     echo $f,$k 
    done 
done 

這是打開兩個目錄,如train_path和$ test_path,我想提取這些路徑simultenously.I所有ARFF文件可以解決這個問題的代碼?任何機構可以幫助?開放多發性目錄中外殼採用相同的for循環

回答

1

使用bash 4,或許像

shopt -s nullglob 
base=/home/user/Thesis/DVD/Features 
printf '%s\n' "$base/"{Training,Testing}/POSITIVE/{MI,IG,Chi-square}/{Unigram,}/*.arff | 
    xargs -P2 extract {} 

如果extract是一個命令提取ARFF文件。您也可以使用GNU並行來執行此操作,並使用相同的參數。

+0

我想提取這些目錄中的文件也?? – user3512562