Skip to content

Instantly share code, notes, and snippets.

@imchao9
Last active June 15, 2016 09:42
Show Gist options
  • Save imchao9/4eb9b6c23288fd69ab44 to your computer and use it in GitHub Desktop.
Save imchao9/4eb9b6c23288fd69ab44 to your computer and use it in GitHub Desktop.
除指定文件文件夹外删除文件和文件夹并打包 delete file and document and zip
#! /bin/bash
lessonId=(1 2 3 4 5 6 7 8 9 10)
for id in ${lessonId[*]};
do
find ./$id -type f -not \( -name 'challenge.html' -or -name 'receive.html' -or -name 'reward.html' -or -name 'story.html' -or -name 'task.html' \) -delete
find . -type d -not \( -name 'challenge' -or -name 'receive' -or -name 'reward' -or -name 'story' -or -name 'task' \) -delete
zip -r $id.zip $id
done
find . -type d \( -name 'libs' -o -name 'node_modules' \) -exec rm -rf {} \;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment