R
Rob
Guest
Hey guys,
I have come across a backup script that stores multiple system files like this:
_path_to_file.txt.gz
_path_to_another_file.conf.gz
Where the underscores form the directory structure.. so the two above would be:
/path/to/file.txt
/path/to/another/file.conf
These are all in the /backup directory..
I want to write a script that will extract each file and put them where they want to be..
so that _path_to_another_file.conf.gz extracts to /path/to/another/file.conf (and overwrites the current one)
and that _path_to_file.txt.gz extracts to /path/to/file.txt (and overwrites the current one)
I know I can tell gunzip to extract it anywhere.. like:
What I need is to run one command that will take each gz file, and extract it to its correct location by changing _ to / to find the path..
Whatcha think?
I have come across a backup script that stores multiple system files like this:
_path_to_file.txt.gz
_path_to_another_file.conf.gz
Where the underscores form the directory structure.. so the two above would be:
/path/to/file.txt
/path/to/another/file.conf
These are all in the /backup directory..
Code:
root@server [~]# ls /backup/
_path_to_another_file.conf.gz _path_to_file.txt.gz
I want to write a script that will extract each file and put them where they want to be..
so that _path_to_another_file.conf.gz extracts to /path/to/another/file.conf (and overwrites the current one)
and that _path_to_file.txt.gz extracts to /path/to/file.txt (and overwrites the current one)
I know I can tell gunzip to extract it anywhere.. like:
Code:
gunzip _path_to_file.txt.gz -c > /path/to/file.txt
What I need is to run one command that will take each gz file, and extract it to its correct location by changing _ to / to find the path..
Whatcha think?