I am not sure whether or not this subject is posted in the right forum.
I need to copy the entire contents of a partition on a networked windows machine (ex: \\10.1.42.xx\d:) and p7zip it into "\home\jeff\dump" folder on my mint box. The compressed file should be maximum deflated, save full path info of the source files and folders and have a date stamp in the filename (ex: backupfile28032014.7z )
Is this easily done and if so, would anyone post a script exaple? Thanks!
script to move files and zipi
Forum rules
Topics in this forum are automatically closed 6 months after creation.
Topics in this forum are automatically closed 6 months after creation.
script to move files and zipi
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
- Pilosopong Tasyo
- Level 6
- Posts: 1432
- Joined: Mon Jun 22, 2009 3:26 am
- Location: Philippines
Re: script to move files and zipi
Move from Newbie Questions to Scripts & Bash. FIFY.specimen wrote:I am not sure whether or not this subject is posted in the right forum.
o Give a man a fish and he will eat for a day. Teach him how to fish and he will eat for a lifetime!
o If an issue has been fixed, please edit your first post and add the word [SOLVED].
o If an issue has been fixed, please edit your first post and add the word [SOLVED].
Re: script to move files and zipi
That would just be one command I think. Have a look at the 7zr manpage:
Code: Select all
man 7zr
Re: script to move files and zip
Thanks very much. The actual compression bussiness is handled in one line:
(ex: sudo 7zr -t7z a //10.1.42.76/dump/backupfile.7z //source/ddrive mx5).
What im having trouble with is developing a bash script that deploys on a shedule and stamps the date into the zip file name to make it unique. Id like the file name to be something like this: backupfile30032014.7z indicating the date the script was deployed.
I know how to do this in a windows batch. I just want to get away from ms and need a helping hand.
Thanks for your time in replying!
(ex: sudo 7zr -t7z a //10.1.42.76/dump/backupfile.7z //source/ddrive mx5).
What im having trouble with is developing a bash script that deploys on a shedule and stamps the date into the zip file name to make it unique. Id like the file name to be something like this: backupfile30032014.7z indicating the date the script was deployed.
I know how to do this in a windows batch. I just want to get away from ms and need a helping hand.
Thanks for your time in replying!
Re: script to move files and zipi
Replace "backupfile.7z" in your command with the following (this is for bash):
Personally, I prefer using YYYYMMDD format over DDMMYYY, as that sorts better on name That would be:
Code: Select all
backupfile$(date +%d%m%Y).7z
Code: Select all
backupfile$(date +%Y%m%d).7z
Re: script to move files and zipi
Outstanding. Thank you so much for the example. Now that I think of it, I like your date suggestion better.