helpchrisplz
asked on
tar only files that have a certain number in filename.
Hi all.
I'm not a pro yet with command line so i wanted to ask here incase i mess anything up with my centOS server.
I have a folder on my server that plesk puts its website backups in:
/var/lib/psa/dumps/
Within this folder it has loads of random backups and configs files along with a folder named domains that holds all the individual backups for each domain that plesk is hosting.
A backup is done weekly and the dumps just keeps storing more clutter.
every month i would like to download only the files that match the latest backup. (for safe keeping)
When a full server backup is done i can see its unique number inside the plesk dashboard. This number is also appended to the end of each backups file name.
So my thoughts are to copy all the files found in dumps/ and its subdirectories that have the unique number in the file names over to a .tar archive.
Then i can simply download the tar each time i need the latest backup.
I have searched online and found this command:
find ./ -type f -name "*.txt" -exec tar uvf myarchives.tar {} +
My unique number for the last backup is 1404190251
This is how all the files names are formed:
weeklyBackup_admin_angela_ 1_14041902 51.tgz
weeklyBackup_angela-wright .com_apach e-files_14 04190251.t gz
weeklyBackup_angela-wright .com_info_ 1404190251 .xml
and so on...
how can i modify the command so that it grabs these files with the number in the center of the filename as they all have different file extensions. Do i just add a * at the front and back like this?:
"*1404190251*"
and will this command do a copy or will it remove the files after adding to the tar archive?
i would like to keep the old files in place if possible.
Thanks.
I'm not a pro yet with command line so i wanted to ask here incase i mess anything up with my centOS server.
I have a folder on my server that plesk puts its website backups in:
/var/lib/psa/dumps/
Within this folder it has loads of random backups and configs files along with a folder named domains that holds all the individual backups for each domain that plesk is hosting.
A backup is done weekly and the dumps just keeps storing more clutter.
every month i would like to download only the files that match the latest backup. (for safe keeping)
When a full server backup is done i can see its unique number inside the plesk dashboard. This number is also appended to the end of each backups file name.
So my thoughts are to copy all the files found in dumps/ and its subdirectories that have the unique number in the file names over to a .tar archive.
Then i can simply download the tar each time i need the latest backup.
I have searched online and found this command:
find ./ -type f -name "*.txt" -exec tar uvf myarchives.tar {} +
My unique number for the last backup is 1404190251
This is how all the files names are formed:
weeklyBackup_admin_angela_
weeklyBackup_angela-wright
weeklyBackup_angela-wright
and so on...
how can i modify the command so that it grabs these files with the number in the center of the filename as they all have different file extensions. Do i just add a * at the front and back like this?:
"*1404190251*"
and will this command do a copy or will it remove the files after adding to the tar archive?
i would like to keep the old files in place if possible.
Thanks.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
yeah the current folder
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
ty
ASKER
where would the .tar file be created? the current folder?