AnkitGoswami
Jun 24 2007, 01:40 PM
I maintain my college's website and since I update it frequently, I decided to write a php script that would backup all the data in a folder on the server itse lf. To backup all the data I would only need to run the script once in a while: CODE <? function dircpy($basePath, $source, $dest, $overwrite = false) { print "=========================================================================== = ";
if(!is_dir($basePath . $dest))
mkdir($basePath . $dest);
if($handle = opendir($basePath . $source))
{
while(false !== ($file = readdir($handle)))
{
if($file != '.' && $file != '..')
{
$path = $source . '/' . $file;
if(is_file($basePath . $path))
{
print 'File ('.$path.') ';
if(!is_file($basePath . $dest . '/' . $file) || $overwrite)
if(!@copy($basePath . $path, $basePath . $dest . '/' . $file))
{
print 'File ('.$path.') not copied.';
}
}
elseif(is_dir($basePath . $path) && $path!="/backup")
{
print 'Dir ('.$path.') ';
if(!is_dir($basePath . $dest . '/' . $file))
mkdir($basePath . $dest . '/' . $file);
dircpy($basePath, $path, $dest . '/' . $file, $overwrite);
}
}
}
closedir($handle);
}
}
print dircpy("","", "backup/", $overwrite = false);
?>
What the script does is copy all the files (including all the files in the subfolders) to the backup folder using recursion. The first time I ran this script I forgot one thing : elseif(is_dir($basePath . $path) && $path!="/backup") I did not put the second condition in the above elseif. Now you might be beginning to understand my problem. The script went into a mad loop and started creating backup/backup/backup/backup/backup/backup....... Now the folders run soo deep that they have exhausted my webspace and I am unable to delete them ('cause of 3 things : first, the folders run too deep, second, they contain .ftpquota files and third, I cannot upload any more files to try and run a script to delete them). Can anyone think of a solution?
Reply
Saint_Michael
Jun 24 2007, 01:56 PM
First I would chmod the php script so it can't be executed by setting the chmod to 000, then I would download a ftp software and that way you can select all those files for a mass delete. Of course I am assuming that that your back ups under a folder one folder so it should make it rather easy to do, if not just delete the files through a FTP software and you should be set  . Once completed delete your old php script and then upload the one you really need.
Reply
Jimmy
Jun 24 2007, 02:09 PM
First, i recommend using SM's suggestion of chmodding the script to 000, then: Well if it's a ftp manager that's refusing to delete them, try using cpanel filemanager and just delete that one folder. Everything should go at once  The cpanel will delete it easier since it's on the server, and hence will do it much faster too! or thirdly, if you want to upload a script to delete them, after chmodding the original script to 000, save a couple of the college's less important files to your computer and then delete them from the server. This should give you enough room to upload a delete script... BUT be very careful with a delete script. Something may go wrong and clean out your college's webserver, which would cause a lot of annoyances...
Reply
AnkitGoswami
Jun 24 2007, 04:30 PM
the trouble is they don't have cpanel but plesk and I hate it. I can't figure out how to use the file manager so I will have to resort to downloading a lot of data and then deleting that on the server to make enough room for uploading files.Then I can run a delete script and also change the bac kup script. The real problem is the site has gone way over the limit (guess the size restriction doesn't apply when you are creating files using php) so I'll have to download a lot and downloading files from ftp is soo slow.
Reply
jlhaslip
Jun 24 2007, 04:45 PM
Is it possible that the php script is being run under a different user than yourself, so you do not have the authority to delete them?
Reply
AnkitGoswami
Jun 24 2007, 06:32 PM
well it is not that I can't delete the folder but whenever I try to delete it the ftp client (or explorer) hangs because of the many many folders that were created inside it. It's like backup/backup/backup/backup/backup/backup/backup..... so the ftp client gets stuck just trying to figure out the time required for deletion. Go ahead and try the script in localhost without the $path!="/backup" in elseif(is_dir($basePath . $path) && $path!="/backup") put the php file in any folder and give the arguments like(in the last line): dircpy("","../", "backup/", $overwrite = false);
Reply
truefusion
Jun 24 2007, 07:19 PM
When you create a folder through a script, you lose permission to that folder because it is given the rights to the group "www-data" and not you. The only way to delete that folder is by having a script do it. But the PHP script can only delete folders that are empty.
Reply
AnkitGoswami
Jun 25 2007, 04:41 AM
I took care of it last night. Yeah, if you directly use the rmdir function in php it will not be able to remove non empty folders so i used unlink for all the files present and then rmdir (using a modified version of the script above).
Reply
Recent Queries:--
cant create folder plesk - 57.61 hr back. (1)
Similar Topics
Keywords : delete folder server mistake script- Users Online
- Looking for the best counter script (9)
Hi people, I am wondering If do you know a good "users online" I know many remote hosted services
for this but I am looking for a counter script to install in my own website, If possible a counter
that displays my visitors information , like country or an image(flag) links where they come from
etc. something like this: Webpage I would SO appreciate any help! because I want to give to
my site a more professional and international look /cool.gif" style="vertical-align:middle"
emoid="B)" border="0" alt="cool.gif" /> ...
Image Calling Problem Solved
- I was having issues trying to call an image from a folder. (1)
What's The Best Script For Web Designing?
- (6)
I've been using PHP for about a month and I like it cos it's so powerful. I don't know
about the others like CGI, Perl..etc. Can anybody tell me the MAIN Difference between these
languages? I'd really love to try them out if I know their advantages, pros and cons. I've
been searching the internet for answers, but they are too complicated and use too many jargons that
newbies like me don't understand....
Why This Error?
- PHP script fault (4)
Hello, I typed out a PHP script (literally copied from w3schools, the script is as follows: CODE
<html> <body> <?php function spamcheck($field) {
//eregi() performs a case insensitive regular expression match
if(eregi("to:",$field) ||
eregi("cc:",$field)) { return TRUE; } else {
return FALSE; } } //if "email" is filled out, send email if
(isset($_REQUEST['email'])) { //check if the emai...
What Is Topsites Script (its In Php)
- (5)
i have been looking at a lot of php scripts lately and i keep seeing this script over and over
again. its called "topsites". what is this "topsites" scrtipt. its in php and i m new to this stuff
so i woulnt know, and non of websites offering the script actually explains what it is. this is a
big forum so i thought you guys might know what it is. so if you know can you please give me a
simple brief explanation of it and how it can be useful for a webmaster. i would appericate your
help. thank you...
What Do You Prefer? A Subdomain Or A Url With A Folder Name?
- (16)
Hi everyone, please see the poll and respond! Let me elaborate here, say if there was a
website, the url itself was around 6 or 7 letters long such as trap17.com, that sort of length, now
would you prefer to see a subdomain on this site, such as sub.site.com or have a folder name in the
URL like site.com/sub, I want the URL to be as easy to remember and as catchy as possible and im not
sure which method would give the best results here. In line with my last post i would appreciate
any links to a website where i can find information like this. But please respond to...
Script.aculo.us - A Library Of Ajax Scripts To Improve Your Website's Design
- many ways to impress your visitors (0)
SCRIPT.ACULO.US Homepage AJAX is a futuristic language used by experts to
program the web. It adds many interesting features which will enhance your website. Click the link
below for a demo of all the things you can do with the AJAX scripts available on script.aculo.us:
http://wiki.script.aculo.us/scriptaculous/show/Demos The current version (1.7.0) of the entire
library of their scripts is available as a download in ZIP , TAR.GZ and TAR.BZ2
format. ZIP {146KB} TAR.GZ TAR.BZ2 Please see the documentation available on...
Inviter Script
- (1)
Gmail inviters and spoolers abound on the Internet, such as here , and here . I'm not
especially planning to make yet another Gmail inviter, but I'm trying to set up a site that
works like a gmail spooler, but that will distribute links for the free icon/Free Delivery sets at
IconBuffet.com. Does anyone know of any ready-made scripts that does this?...
Proxy Server?
- how to make one work (5)
allright so im trying to setup a proxy server the one where you login and type in a url and the page
gets forwared to you you know what i mean? like ecoproxy.com ive got a server(not
trap17's...) to host it and stuff just need help with how to set it up...
Reseller Hosting Script
- InvasionPanel.com (8)
Hey my friend just made a new site selling reseller hosting script Its called InvasionPanel Its a
script Which has cPanel and InvasionPanel (Something like WHM) Features of reseller hosting panel
(InvasionPanel) CODE Administration - Settings - Advertisement settings - Reseller Packages -
Create Reseller - Reseller Management Server - Server Information - Service Status - Reseller
Information - Reseller Usage cPanel Accounts - List Accounts - List Suspended - Create a New Account
- Password Modification - Suspend Account - Unsuspend Account - Terminate Account -...
Wordpress Databases And Privileges
- My friend wanted to install wordpress on his server (not on trap17.com (2)
My friend wanted to install wordpress on his server (not on trap17.com) and he has phpmyadmin 2.6.0
and dosnt have the ability to make privliges /blink.gif" style="vertical-align:middle"
emoid=":blink:" border="0" alt="blink.gif" />.How would he set up wordpress without the ability to
set privliges? If you had any suggestions (like step by step directions /tongue.gif"
style="vertical-align:middle" emoid=":P" border="0" alt="tongue.gif" />) that would help alot.
Thankyou,
...
Log In Script!
- Please can someone make me a log in script! (6)
Hi please can someone either make me a log in script or give me a direct url to a code for one!
Thanks! /biggrin.gif" style="vertical-align:middle" emoid=":D" border="0" alt="biggrin.gif" />...
script hosting?
- (4)
does anybody know where to get free script hosting where the scripts are actually good? everywhere i
search, its just crappy scripts people made when they where bored. /huh.gif"
style="vertical-align:middle" emoid=":huh:" border="0" alt="huh.gif" />...
Top Ten Web Script Libraries
- (6)
1) Moo.fx - A superlightweight, ultratiny, megasmall javascript effects library, written with
prototype.js. It’s easy to use, fast, cross-browser, standards compliant, provides controls to
modify Height, Width, and Opacity with builtin checks that won’t let a user break the effect with
multiple crazy clicks. It’s also optimized to make you write the lesser code possible. 2) Rico - An
open source JavaScript library for creating rich internet applications. Provides full Ajax support,
drag and drop management, and a cinematic effects library. 3) Swat - Developed by silver...
How To Incorporate A Php Script To My Website
- php beginner needs help (7)
Well i dont know exactly how to say this but i ll try. So last few months i ve been discovering web
design, dreamweaver, photoshop. I learned how to create layout and how to preapare it in dreamweaver
but now i am stuck with php. I dont know how to put script in desired cell an lots of other stuff.
yeah i am stupid, but i am who i am. all those tutorials are not helping me because they dont tell
you how to install script where i want. i am going to explode. i tried to find finished script on
hotscripts.com but i cant/dont_know which one will suite my needs. my layout is...
Free Chat Script
- (9)
deos anyone know a good, fast, free chat script that i could put in my website. one with out
advertisements. one with no strings attached. everyone these days are trying to make money off every
type of script. only if all scripts were open source. the world would be a much better place. thanks...
Great Script Site
- (20)
I've loved this site since I first found it a couple years ago. It has 12 php related scripts,
but also links to many other resourceful sites and tutorials, as well as a forum board much like
this one that is pretty straightforward and easy to get help if you have any questions.
codegrrl.com <---check it out!...
Flash Communications Server
- Who Here Is Using This Server? (6)
Hello Anyone in the forum here have flash communications server installed on thier machine along
with an http server,and got it configured to deploy swf applications. I'm just getting started
with the setup,and would like a list of users that I could call on for help from time to time.If
there are some of you out there what http server are you using with it,and do you have an
applications server running with it as well?
Hoping for some Replys ...
Asp Script For A Social Networking Site!
- need a script like hi5 site (3)
Helllo guys! Can anyone of you suggest me where can i get a free script like hi5.com either in
asp or php ? plz dont suggest hotscripts.com or to do a google search because both gave me no
quality result thanks in advance...
Several Cms@same Server
- is it posible? (5)
Can i install (without having troubles) multiple cms at the same server, in the same folder? Im
testing various cms in this hosting, but each one in its own separate folder, in order to have more
aesthetic URLS, for example, i would like the news section address to be like this:
mysite.com/news Instead of mysite.com/joomla/1/?p=1 Or something like that... But i think if i
install several cms they would overwrite each other or be incompatible... so please if anybody can
give me further explanation ... thanks in advance! -10730...
Html Form Help Please
- finding a form script (2)
Does anyone know of any tutorial or can help me with making a form. I'll describe the situation
and lets see if you can help me. Ok like a few form or text areas that when you put some text into
them they'll input the words from the form area above into another form or textarea under it.
Sort of like an online html maker where you can select your background colors, put an image url in a
field, and some other options THAN you hit a button that says generate. and it generates a website
html source code where you can copy the whole thing and paste into your own we...
Script Help! Plz Help
- (1)
ok i want to no how to set a character for this script: the characters would be:
0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ() -_ CODE <td
width=100><input style=\"border:1px solid #76a5d5; WIDTH: 115px;
HEIGHT: 20px; FONT COLOR: #ffffff; color:white; BACKGROUND-COLOR:
#000000\" type=text size=15 maxlength=15 length=20 name=user
value=\"\"></tr> thanks if u can help =/...
Move/delete Image On Webpage Automatically?
- (2)
Hi, Im creating a website that sells carpets and basically ive created webpages with the picture and
checkboxes underneath the pictures so users can select which carpet they want! Once they submit
the form, we get the order including form details! The problem is that once the user checks the
checkboxes, i want to be able to delete that image from that webpage or move that picture to another
location in the folders i have stored on the server. The reason is becuase evry carpet is unique so
that two people cant order the same carpet! Now wat is the best way 2 d...
Javascripts
- Looking for a particulat script (1)
Hey all, Ive been looking for a script for my website that will let me have a news ticker at the top
and a vertical autoscroller at the side, at the same time, none of mine work together, they all
counteract each other, does anyone have any?...
Help with My .shtml
- My Server side include isnt working :( (3)
Ok I need Help i'm trying to include a page on a page with Server Side Include (SSI) And I get
This everytime: The code i used is: CODE <!--#include virtual="
/home/silverbo/public_html/link.html"--> I've Also Used : CODE
<!--#include file="link.html"--> Can anyone help...
Looking for delete, folder, server, small, mistake, script,
|
|
Searching Video's for delete, folder, server, small, mistake, script,
|
advertisement
|
|