script to tar and copy directories
Hey, I thin开发者_开发知识库k the best way to ask this question is to show what I need to happen.
I need to go from:
Project_Direcory
Project
Solution1
Solution2
Solution3
To:
Project_Direcory
Project.tar.gz
Solution1.tar.gz
Solution2.tar.gz
Solution3.tar.gz
Project.tar.gz still contains all the Solution directories. I am having issues where it is copying files that are inside of the solution directories and placing them in the Project_Directory. There are also some text files in Project, that should not be copied. I am currently trying:
for file in $(find /place/* -type d);do tar zcf ${file}.tar.gz $file;done
for file in $(find /place/* );do mv ${file} /place;done
for file in $(find /place/* -type d);do cp -r ${file} /place;done
What is the best way to do this?
Use find -maxdepth 2
to restrict the depth.
精彩评论