Skip to content

Instantly share code, notes, and snippets.

@nboliver
Last active August 29, 2015 14:08
Show Gist options
  • Save nboliver/db566f7eb9d9e192297d to your computer and use it in GitHub Desktop.
Save nboliver/db566f7eb9d9e192297d to your computer and use it in GitHub Desktop.
## Delete all files with exceptions
find . -not -name "wp-config.php" -not -name ".htaccess" -not -name "mytar.tar.gz" -exec rm -rf {} \;
## Create tar file excluding all from .tarignore
tar -c --exclude-from=.tarignore -vzf myfile.tar.gz *
## Create tar file without ._ files and excluding other files
COPYFILE_DISABLE=true tar -zcvf mytarfile.tar.gz --exclude='myfile.php' *
## Extract tar file
tar -xvf myfile.tar.gz
## Create zip file excluding all unneseccary files
zip -vr myfile.zip folder-to-zip -x '*.DS_Store*' -x '*.dropbox*' -x '*.git*' -x '*._*' -x '*.tarignore*' -x '*/node_modules/*' -x '*.psd' -x '*.ai' -x '*.eps'
## Edit hosts file
sudo nano /private/etc/hosts
## Remove .DS_Store (or other) files from directory
find . -name '*.DS_Store' -type f -delete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment