I have directory A and B. Each of them contains another directory with item.json inside. Only item.json file is persistent in directories so I can't copy-paste the directories.
./path/Item A/item.json ./path/Item B/item.json ... ./path/Item Z/item.json
./new/Item A/item.json ./new/Item B/item.json ... ./new/Item Z/item.json
How should I copy all item.json files from
./path/ to appropriate folders in
To get directories
ls -l ./path | grep "^d" | cut -d' ' -f 16
So then I can use the results as:
for i in `ls -l ./path | grep "^d" | cut -d' ' -f 16`; echo "Dir: $i"; done
So I can do
cp with them
for i in `ls -l ./path | grep "^d" | cut -d' ' -f 16`; cp "$i/item.json" "../new/$i/item.json" ; done
And this solution is ok, but I believe there's much more elegant way.