Copy folder structure and specific file types

I need to publish my code to gihub but my folders contain a lot of extra files such as setting files, input data files, etc. To upload only the code file, in my case, only python files there are two solution:

  1. create gitignore file and allow only .py
  2. make a new folder, clone all python files and folder structure – this is what I did. Below is the command

find . -type f -name '*.py' | cpio -p -d -v targetdir/
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s