Frage

I have the following folder structure:

Folder1       
--FolderA    
  --Gex_experiments     
--FolderB     
 --Gex_experiments     
--FolderC    
 --Gex_experiments    
.......      
--FolderAYCD
 --Gex_experiments

In each Gex_experiments folder there's a *_GEX.txt file I would like to move to FolderA in the case of Gex_experiments folder under FolderA, to FolderB in the case of Gex_experiments folder under FolderB and so on.

Can anyone help me please?

Best!

War es hilfreich?

Lösung

From folder1 you can run:

for file in *; do
  if [ -d $file ]; then
    cd $file; mv Gex_experiments/*_GEX.txt ./; cd ..;
  fi
done
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top