Skip to content

Instantly share code, notes, and snippets.

View joselcvarela's full-sized avatar
🤓
Developing the world

José Varela joselcvarela

🤓
Developing the world
View GitHub Profile
@gilyes
gilyes / Backup, restore postgres in docker container
Last active March 23, 2024 09:30
Backup/restore postgres in docker container
Backup:
docker exec -t -u postgres your-db-container pg_dumpall -c > dump_`date +%d-%m-%Y"_"%H_%M_%S`.sql
Restore:
cat your_dump.sql | docker exec -i your-db-container psql -Upostgres
@branquito
branquito / file-folder-rename-bash-recursive.txt
Created March 1, 2013 00:19
batch rename files or folders recursively in bash
command to find recursively files {can be modified for folders too, change -type f}, and renamed them by specfying regex pattern
find . -type f -maxdepth [depth] -name "[filepattern]" | while read FNAME; do mv "$FNAME" "${FNAME//search/replace}"; done
example:
find . -type f -maxdepth 1 -name "domain*.php" | while read FNAME; do mv "$FNAME" "${FNAME//domain/lead}"; done
before: after: