a script to pack different folders to a zip file
Hi there lovely community.
In the past (with your help) I have written a bash script that backs up my thesis and send it over email for remote backup. I want to change the below line tar -jcvf "$COMPRESSEDFILENAME" "$THESISFOLDER" so it does not take all my thesis folder but only the *.tex files and two subfolders and compresses them to a single compressed file. Reason is that these are the most important parts and that would keep the overallsize of the compressed file at reasonable size levels. Can you help me tweak he above line? Regards Alex |
Hi!
Well, consider this directory: Code:
ls Code:
tar -cvf mytarball.tar *.tex dir1/ dir2/ Code:
tar -tf mytarball.tar Best regards, HMW PS. I ignored the -j (bzip) option for easier viewing of this example. DS |
You can also set up a text file listing the files and/or the directories to be zipped save it as , say, 'backup-in' and then your backup script would be something like
Code:
tar -czf your_backup_filename -T /path/to/backup-in Code:
tar -czf filename -X /path/to/backup-out |
thanks for the answers,
what would be your suggestions for also doing an ftp send of the zipped file? which command line client to use? Alex |
tar -jcvf "COMPRESSEDFILENAME_SHORT" "$THESISFOLDER/*.tex" "$THESISFOLDER/chapters" "$THESISFOLDER/appendices"
tar complains about the "$THESISFOLDER/*.tex" -->No such file or directory. What I want is to just grap the .tex files inside the folder |
Quote:
Code:
...$THESISFOLDER"*.tex" ... etc And by the way, you may not have liked my text file approach, but just in case, my second choice code missed out the folder to backup and then the text file tells tar what to leave out. |
it keeps complaining
tar: /home/removed_this_part_Thesis/*.tex: Cannot stat: No such file or directory otherwise the path is correct . I think it is more that it doe not undertand the wildcard |
Try with the quotes around the wildcard removed, like tar -jcvf "$COMPRESSEDFILENAME" $THESISFOLDER/*.tex
|
great thanks it worked.
Can I also get some hints on how to do ftp uploading of my zip files? Alex |
probably rsync would be much better (instead of tar/ftp).
|
All times are GMT -5. The time now is 09:10 PM. |