Looking to create a few basic scripts for a bsd machine
#1
Looking to create a few basic scripts for a bsd machine
Hi peeps,
Its years since I touched unix in any great depth but I now need to create 2 scripts Im hoping someone can help me with or where I can find one
Script 1
Basic Backup script
All it needs to do, at the moment is make a copy of a folder in /usr/home and then tar it together, gzip it and then move it to a web accessable folder for download, renaming the file to backup090905.tar.gz if poss.
Script 2
Rubbish deletion script.
Now this folder has several hundred folders and subfolders containing images. Some of them have *.bak and thumbs.db in them and over several hundred folders it mounts up. Im looking for a script to create a file so I can review it and then if if its all ok, delete it.
Anyone know whats required/where I can get one from. I have googled for it !
Cheers
Stu
Its years since I touched unix in any great depth but I now need to create 2 scripts Im hoping someone can help me with or where I can find one
Script 1
Basic Backup script
All it needs to do, at the moment is make a copy of a folder in /usr/home and then tar it together, gzip it and then move it to a web accessable folder for download, renaming the file to backup090905.tar.gz if poss.
Script 2
Rubbish deletion script.
Now this folder has several hundred folders and subfolders containing images. Some of them have *.bak and thumbs.db in them and over several hundred folders it mounts up. Im looking for a script to create a file so I can review it and then if if its all ok, delete it.
Anyone know whats required/where I can get one from. I have googled for it !
Cheers
Stu
#2
This info may not be 100%, I've been away from Unix for about 10 years, but if it doesn't work it'll be a starter for 10 for you ;-)
Script 1:
tar cf - 'find /usr/home' | gzip > <filename>
Script 2:
find <pathname> -name '*.bak' -exec rm {} \;
find <pathname> -name 'thumbs.db' -exec rm {} \;
Also this is a good link for command reference at www.linuxdevcenter.com/linux/cmd/
Script 1:
tar cf - 'find /usr/home' | gzip > <filename>
Script 2:
find <pathname> -name '*.bak' -exec rm {} \;
find <pathname> -name 'thumbs.db' -exec rm {} \;
Also this is a good link for command reference at www.linuxdevcenter.com/linux/cmd/
Thread
Thread Starter
Forum
Replies
Last Post
Sam Witwicky
Engine Management and ECU Remapping
17
13 November 2015 10:49 AM