DaemonForums  

Go Back   DaemonForums > Miscellaneous > Programming

Programming C, bash, Python, Perl, PHP, Java, you name it.

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1   (View Single Post)  
Old 15th January 2010
bgobs bgobs is offline
Port Guard
 
Join Date: Jun 2008
Location: Sofia, BG
Posts: 17
Default Request for sh script for compressing files

I need bash script to backup my sites. Something like this:

(I dont know very well english so I'll try to explain myself with PHP )

Code:
$date = date("m-Y-");
$sitesPath = "/some/path/to/web/sites/";
if (is_dir($sitesPath)) {
	$handle = opendir($sitesPath);
	if (!empty($handle)) {
		while (false !== ($file = readdir($handle))) {
			if (is_dir($sitesPath.$file)) { $dir_array[] = $file; }
		}
		
	}
	closedir($handle);
}


if (is_array($dir_array)) {
	foreach ($dir_array as $dir) {
		echo "Archiving: ".$sitesPath."/".$dir."<br />";
		exec("tar -zcvf ".$date."-".$dir.".tar.gz ".$sitesPath."/".$dir);
	}
}
Can someone write bash script for me and for free? just for my deep dark brown eyes ?

And of course sorry for my english

Thanks for reading !
__________________
FreeBSD 6.2 RELEASE
Reply With Quote
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
matts: a shell script to mail attachments from the command line J65nko Guides 7 3rd August 2022 03:13 AM
Request for guides milo974 General software and network 1 16th December 2009 06:42 PM
mod_gzip2 not compressing pages Weaseal FreeBSD Ports and Packages 0 23rd September 2008 11:56 PM
Request for Opinions: A secure way of sharing modules TerryP Off-Topic 2 10th August 2008 07:18 PM
Create a script to rmove oldest files disco Programming 5 14th July 2008 09:25 PM


All times are GMT. The time now is 09:47 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick