Created
January 11, 2012 15:25
-
-
Save jescalan/1595167 to your computer and use it in GitHub Desktop.
bash file management
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # This script is a great shorcut for managing a large number of files. | |
| # It runs through all the files in the present working directory, compares them | |
| # against a regex, and then you can do what you want with the matches | |
| for f in * | |
| do if [[ "$f" =~ some_regex ]] | |
| # do something to the files that match | |
| # this is just an random example that zips them | |
| then zip "$f.zip" $f | |
| fi | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment