Bash script to delete then move ALL files.

User discussion and information resource forum for scripting of TeraByte products using script lanugages such as TBScript, VBScript, Batch Files, and more.
Post Reply
badams_ios
Posts: 39
Joined: Wed May 23, 2012 6:53 pm
Location: Oakdale, Ca
Contact:

Bash script to delete then move ALL files.

Post by badams_ios »

I know absolutely NOTHING about scripting. I'm running Linux Mint 17.3

I need a new bash script that will run as a cron job.

Then, let's say I have 2 folders we'll call A and a sub-folder, B. On a day specified by cron, I want to delete all files from B. No errors if none exist, just keep going to step 2. Step 2 should MOVE all files from A to B. No errors if nothing exists in A.

Here's my scenario. On the 1st Monday of each month at 6:00 am, a full backup is made to a shared folder. On the 2nd, 3rd and 4th week, it'll make a differential backup to the same location. Those I already have working. THANKS to the support team here! Then on the 1st Monday, at 2:00 am it deletes all the files in B and moves all of A to B.

I'd like to ADD to the scripts that make the backups, a warning that the system is going to reboot and give me 5 minutes to save any work. Just a simple eye catching box in the middle of the screen that says "GOING DOWN!" It doesn't need to say "In 5 minutes" and it doesn't need to give a count down. (Unless you feel like it :lol: It'd be nice if I could minimize that message, but no big deal if I can't.
TeraByte Support(PP)
Posts: 1478
Joined: Fri Aug 12, 2011 12:51 am

Re: Bash script to delete then move ALL files.

Post by TeraByte Support(PP) »

I've attached a zip file with several short scripts you should be able to tweak/schedule how you want. One will delete and move files and two will show a notification message (different programs). I would recommend testing with files that don't matter first before using on your backups -- don't want to lose them while getting things configured.
Attachments
scripts.zip
(814 Bytes) Downloaded 1060 times
Paul Purviance
TeraByte Support
badams_ios
Posts: 39
Joined: Wed May 23, 2012 6:53 pm
Location: Oakdale, Ca
Contact:

Re: Bash script to delete then move ALL files.

Post by badams_ios »

Thanks, I'll give 'em a try soon.
Post Reply