Merge pull request #1 from jamesbright/jamesbright-patch-1

Added find bash script for file extensions
pull/393/head
James Ononiwu 2023-03-09 12:41:23 +01:00 committed by GitHub
commit cc848642dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 0 deletions

View File

@ -2148,6 +2148,18 @@ find . -depth -name '*test*' -execdir bash -c 'mv -v "$1" "${1//foo/bar}"' _ {}
find / \( -perm -4000 -o -perm -2000 \) -type f -exec ls -la {} \;
```
###### Recursively find/replace files extension ext1 with ext2
```bash
find . -name "*.ext1" | while read i; do mv "$i" "${i%.ext1}.ext2"; done
```
###### Recursively find/replace link extension ext1 with ext2 in files of extension ext
```bash
find . -name '*.ext' -exec sed -i 's/\.ext1/\.ext2/g' "{}" \;
```
___
##### Tool: [top](https://en.wikipedia.org/wiki/Top_(software))