سؤال

A python.py script lies in a directory that is above the directories date and data. Each data directory contains two ON and OFF directories as ~/dir_pyhton.py/dir_dates/dir_data/dir_ON, dir_OFF How can the python script be pointed to run in dir_ON and dir_OFF with a bash or tcsh command? - or another way?

هل كانت مفيدة؟

المحلول

You can use the find command to locate the ON and OFF directories, then pass them to the python script, like so:

cd ~/dir_pyhton.py/
find dir_dates/dir_data -type d \( -name "dir_ON" -or -name "dir_OFF" \) | xargs python python.py
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top