Skip to main content
Improve formatting.
Source Link
Augustin
  • 2.6k
  • 1
  • 24
  • 24

I am trying to automate the process of syncing my web assets with google cloud storageGoogle Cloud Storage. I basically need to copy everything in my development directory up to the cloud. However, I need to ignore the .git.git directory and some other irrelevant files.

I can't just do a 'gsutil cp -R . 'gsutil cp -R . <dest> because that takes absolutely everything, including .git.git. I tried 'find .|fgrep git|gsutil cp -I 'find . | fgrep git | gsutil cp -I <dest> but that flattens all directories and puts them in root!

Is there a way I can solve this with gsutilgsutil or do I have to do a loop in script which uploads all directories (except .git.git) with -R-R and then uploads individual files in current directory?

I am trying to automate the process of syncing my web assets with google cloud storage. I basically need to copy everything in my development directory up to the cloud. However, I need to ignore the .git directory and some other irrelevant files.

I can't just do a 'gsutil cp -R . ' because that takes absolutely everything, including .git. I tried 'find .|fgrep git|gsutil cp -I ' but that flattens all directories and puts them in root!

Is there a way I can solve this with gsutil or do I have to do a loop in script which uploads all directories (except .git) with -R and then uploads individual files in current directory?

I am trying to automate the process of syncing my web assets with Google Cloud Storage. I basically need to copy everything in my development directory up to the cloud. However, I need to ignore the .git directory and some other irrelevant files.

I can't just do a gsutil cp -R . <dest> because that takes absolutely everything, including .git. I tried find . | fgrep git | gsutil cp -I <dest> but that flattens all directories and puts them in root!

Is there a way I can solve this with gsutil or do I have to do a loop in script which uploads all directories (except .git) with -R and then uploads individual files in current directory?

adding appropriate tag
Link
mimming
  • 14k
  • 3
  • 46
  • 74
Source Link
Shahbaz
  • 10.5k
  • 21
  • 56
  • 87

How to do gsutil cp -R while ignoring files like .git, .gitignore?

I am trying to automate the process of syncing my web assets with google cloud storage. I basically need to copy everything in my development directory up to the cloud. However, I need to ignore the .git directory and some other irrelevant files.

I can't just do a 'gsutil cp -R . ' because that takes absolutely everything, including .git. I tried 'find .|fgrep git|gsutil cp -I ' but that flattens all directories and puts them in root!

Is there a way I can solve this with gsutil or do I have to do a loop in script which uploads all directories (except .git) with -R and then uploads individual files in current directory?