CopyDir (Copying One Directory To Another)
I was wondering if it was posible for someone to point me in the right direction.
What i need to do it copy the contence of an entire directory to another designated destination, is this possible and if so could someone point me somewhere i where i can figure it out.
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Copying A Directory
I think i can use copy() to do this, but i just dk how :S. i can only get it to copy files. I need a script that can copy a folder, and all the files in that folder, and "paste" it in a new directory.
Copying Files
The situation is I have a template.php file, and I wan't my script to copy this file and give the new copy a new name. This is the code so far, but it doesn't copy... $temp = "template.php"; $file = $linktextdata . ".php"; if (!copy($temp, $file)) { echo "copy of $temp failed"; } I test echoed the variables, and they look ok.
Image Copying
I have this form tag to send an image to my message board: <input type=file name=picture> and the enctype="multipart/form-data" in in the form tag. I them use $picure_name to do two things. First, I alter the message the include the img tag using str_replace. That part works fine. I then try to copy the message to the images directory:exec("cp $picture /full/path/to/mbimages/$picture_name"); The image never gets there. I don't get any error messages, but the image never shows up in that directory.
Copying Remote Files
How do i copy a picture or another file from a remote webpage, and put it into my webpage dir?
Copying From One Mysql Database To Another
Is it possible to open a connection to two separate mysql databases in order to copy the data from one table in the first database into a table in the second database? I'm assuming the answer is yes, but I'm confused as to the proper php syntax.
Files And Folder Copying
I am trying to write a function to copy an existing folder and folder structure but am already stuck. What I want to do is the following: Copy a default folder (default_folder) and all sub folders within it (down to a possible 4 levels) eg default folder ->subfolder1 ->subfolder2 ->sub subfolder1 ->sub sub folder 2 I have a form where the user can enter the name of the new folder and an option to confirm if they want to copy the files also located within the default folder. If the checkbox is not checked then copy just the folder structure only Can this be acheived in one function or will it be based on 2 where a set of empty folders are created and where the folders and files are copied over
Copying Entire Directories
I need to copy all of the files from one directory to another. This has to happen on the fly. The files that are being copied are actually templates for another site that will be created. I have seen the example on php.net under the fopen section but it doesnt work.
Copying Rows To Another Table
After I select a row whose ID is 10 or some other number, I need to copy the entire row into another table. Is there a way to copy rows between tables using PHP? Could someone please point me to an example..
Copying Files From One Server To Another
I am trying to set up a link excahnge program using php and I need to know how to copy a file from one server to another. See when people change the banner they have displayed they can enter the location of their banner, such as http://them.com/banner.gif and then i need to copy it over to my server and into there dir, such as www.me.com/them/banner.gif. Does anyone know how i can do this. I have tried many things but nothing has workd so far.
Copying Old Folders To A New Location
I'm trying to write a page that would make a copy of a set of folders to a new location for an intranet. There is lots in the page for debugging that would vanish once I get it to work. The problem I'm getting is I cannot get XCOPY to work. Other dos commands work fine. Code:
Copying A File From On Server
Let's say I have a file on my server at location: /public_html/Global/oilers.php ...and i want to copy this file and save it to another directory (using ftp commands): /public_html/hockey/Oilers/oilers.php How would I go about.... I gigured out how to login using ftp commands and explored the ftp command available.. (eg.put, get etc..) but I'm not sure which command to use.. can someone point me in the right direction?
Copying Files Using A Loop
I have a spreadsheed with names and image urls that I have converted to a tab delimited text file. Column one has the product name and column two has a url to an image on another site. I am trying to loop through the file and copy the image onto my computer, but it is giving me this error: "Warning: copy(http://ec1.images-amazon.com/images/I/41Oj92a63gL._AA280_.jpg ) [function.copy]: failed to open stream: HTTP request failed! HTTP/1.0 404 Not Found in C:Program Filesxampphtdocscopy.php on line 16" Code:
Copying A Multidimensional Array To $_SESSION
Specifically, is it possible to copy a multidimensional array into the $_SESSION array - ie a deep clone of all keys and data? I naively assumed that $_SESSION["myArray"'] = $myArray ; would work but it doesn't appear to work. Is there a single function or assignment I can use, or would I need to use a "foreach" at every level?
Error While Copying Files After Upload
I'm trying to allow users to upload to the server. The system seems to upload okay (at least it takes a while for the page to refresh after the submit button is pressed). When the submit button is pressed and the files are uploaded, it reloads the script (a $PHP_SELF in the form tag). What happens next is that it tries to copy the uploaded files (a maximum of 3 files can be uploaded) to a more permanent directory on the server. code:
Copying Variable Part Of A String
I have strings like these: $line = "Item <name> xxx stock, costs yyy and will sell for amount zzz"; Problem is <name> can consist of 1..n words. Most items are single words, but some are up to 8 in my example, and there are is no set maximum (well, max is 80 chars I believe, have to look in the stock db, not too relevant I think) I found this out the hard way. I thought I was clever (never do that again) by doing this: $words = explode (" ", $line); $itemname = $words [1]; This only works for single-word names. Now I want to create or use an existing function that simply copies everything between Item and the first numerical substr. The function then should look like: $itemname = GetSubStr ("Item" , <numerical> , $line); <numerical> should be a template of some sort I think.
Controlling The Copying Of Images From A Site
Is there a way to prevent users copying a full size image from a web page. Displaying the image with a smaller width and height only affects the image as viewed, the actual full size image file is still downloaded. I know I can get around it by having two versions of an image, the full size one and a smaller on for display purposes. but is there a way around having to have two images and use the full ssize one and stop it being copied or if copied will only be a thumbnail?
Copying File From Hosted Remote Sever To Local Machine
I am trying to use php to automate the copying of a file from my remotely hosted directory to my computer. I have put together the following but it will only do the copying from one directory to another on the remote server. Reading the postings on these functions they suggest that it can be done but it appears to be the case if your are hosting your site on the same machine you want to copy the files to. Does anyone know if there are functions in php to do the transfer from remote server to my machine or if the code below will acheive this with modification? <?php $ftp_server = "xxxxxxxx"; $ftp_user = "xxxxxxx"; $ftp_pass = "xxxxxx"; $local_file = 'myfile.txt' $server_file = 'myfile.txt' // set up a connection or die $conn_id = ftp_connect($ftp_server) or die("Couldn't connect to $ftp_server"); $login_result = ftp_login($conn_id, $ftp_user, $ftp_pass); // check connection if ((!$conn_id) || (!$login_result)) { die("FTP connection has failed !"); } // try to change the directory to myfilesdirectory if (ftp_chdir($conn_id, "myfilesdirectory")) { echo "Current directory is now: " . ftp_pwd($conn_id) . ""; } else { echo "Couldn't change directory"; } if (ftp_get($conn_id, $local_file, $server_file, FTP_BINARY)) { echo "Successfully written to $local_file"; } else { echo "There was a problem"; } // close the connection ftp_close($conn_id);
Active Directory / Exchange / Active Directory.
I'm creating an Intranet module for a client (Forum, files upload...etc...etc). This client already has a huge server running on WIN2000 + IIS 4 + Exchange + Microsoft Active directory + proxy and finally PHP 4.03 + MySql. Problem #1 : All passwords are changed every weeks, so I want to be able to import users/pass from Microsoft exchange .... Does anyone have an idea to do such thing with PHP ? Problem #2: I would like that the user logged from the firm's network do not have to log. again when connecting the module. So, is it possible to do such thing ?
PHP As Directory
How would I go about using a PHP file like a directory, for example, "http://mysite.com/index.php/virtual_page23"? I would like to use that form instead of "http://mysite.com/index.php?p=virtual_page23". Also, is this possible in IIS?
Directory
In php is the way to upload all the contents of a user selected directory up to a certain spot on a website?
About Directory
How to check correctly if the directory already exist in the webroot? I've tried with this syntax: .... bool $state = mkdir( "test" ); if ( $state == false ) chdir( "test" ); ....
This Directory
Is there a way to read all of the files in the same directory without writing out the directory path? I want to put the same index file into a bunch of different folders and I want a way to say "This Folder" instead of changing the file each time.
Directory
How is it possible to return the current folder's name? I tried explode("",getcwd()) but that doesn't seem to work. Basically, getcwd yields C:path ofile I want to be able to return just the end (in this case, file)
Regarding OS Directory
What I'd like to do.. is hide the table "Links" if there's none there to be shown instead of having "There are no links here" I myself don't know how to do this but what i have noticed is if you don't have any categories it doesn't show up the table... just wanting the same thing to happen with the links table... I'm using OpenLD btw Code:
Uploading A Directory
It's very easy to upload a file using the post method with php. The user selects the file that he will upload and submits the form... What I want to do is uploading all the contents of a directory. The user will select a directory and all the files in that directory will be sent to the server. Is it possible to do this with php ? If so how ?
Creating Directory
I am trying to make my webpage create a file for each person that submits a file, so at first I was using... $myfile=fopen("create/$user.txt","w"); This worked, and it would create the file if it was not there. Then I decided that each user would recieve their own directory, and that the first file to be edited was called options.txt, in their user directory. So, I used this: $myfile=fopen("create/$user/options.txt","w"); But it came back saying that the directory did not exist. Is there a way to create a directory along with the new file that goes into it?
Best Way Of Showing Directory
Im tring to create a script that will show directorys and files.. but.. i cant get it ti show another directory.. for example right now the main directory is lets say.. bo and its showing another directory that is named images.. how can i get my file. that is in the boo directory to view the images directory...
Use File_exists On One Directory Only??
I am developing a system in php which enables users to upload files. Users can then select a directory and the files in that directory are then outputted in a table. However, I do not want users to be able to upload a file to a directory if a file of the same name already exists within that directory. I thought I could use file_exists but as I want to restrict the search to one folder at a time, as opposed to the whole file system, I dont think this will work. Another option was to run a loop on each file name in the directory and compare it to the name of the file being uploaded. This wont work either however as php considers test.doc and Test.doc to be different where as a file server considers them to be the same. Therefore if a file called test.doc already exists and a user tries to upload a file called Test.doc they will not be considered the same and the upload would be allowed by php. This would then overwrite the original file (test.doc) with Test.doc.
Directory Deleted
So far i m using following code for deleting folders and files.But it will only delete those folders which r empty.I want to delete those folders also which has some files.pls give me the solution <?php error_reporting(0); include("../connection.php"); $date = date("m/d/Y"); //For finding current current function dateDiff($dformat, $endDate, $beginDate) { $date_parts1=explode($dformat, $beginDate); $date_parts2=explode($dformat, $endDate); $start_date=gregoriantojd($date_parts1[0], $date_parts1[1], $date_parts1[2]); $end_date=gregoriantojd($date_parts2[0], $date_parts2[1], $date_parts2[2]); return $end_date - $start_date; } ?> ....................
PHP Scripts To Run In Another Directory With IIS
I would like to have PHP for windows run in another directory than c:inetpubwwwroot. I have tride changeing parameters in php.ini in my c:php directory. But nothing changes. When I run the phpinfo() I always get Configuration File (php.ini) Path as c:windows. But I do not have the php.ini file there. Is there something I am doing wrong or is it a bug....
Chmod A Directory
How can I chmod a directory to 0777. I tried chmod ($myDirectory, 0777); but nothing happens.
Can't Get PHP To Run On ISS Virtual Directory.
I can't get PHP to run on ISS virtual directory. PHP runs fine if run from the www root, but if I create a virtual directory to another local drive and put the PHP files in there I cannot run them. If I put a normal html file in the virtual directory that works fine. I have checked the app mappings and PHP is in there and mapped, any ideas?
How To Get Current Directory ?
How to get the current directory under windows and linux (both share the same code)? I cannot use getcwd , because the server only support php3.
Enquiry On /tmp Directory
Warning : "The sessions directory does not exist: /tmp. Sessions will not work until this directory is created." I am getting this warning in my php based website, despite creating /tmp folder in the root dir where php is installed.
Checksum Of A Directory
I am trying to write a function wherein any change in the files in any folder on my webserver would shoot me an email alert. I thought that one easy way of doing it would be via monitoring files/folders for their checksum at periodic intervals but I have no clue how to calculate checksum for a file or folder via php. Can anyone point me in the right direction. I tried searching on google, but I guess I might be using the wrong keywords..
Hidden Php Directory
I've recently had what looks like an attack on a web server. The machine is running iis 6 on windows 2003 server. with php 5.0.3 and mySQL 4.1.8 installed and running. The attack has deleted my phpMyAdmin folder plus files and has hiddene the C:php directory. The folder isn't visible in Windows Explorer, but it can be viewed with the command line using the Run application. It also appears the folder with php in their name are also not visible. If anyone has any idea whatmight be causing this phenomena, please send whatever knowledge you have.
Renaming Directory
Anyone know how to rename a directory with php code. Or does the rename($file_old_name, $file_new_name); work with directories too??
Image Directory
I'm having problems with the directory structure of my website, the website is in php and each page has several includes. the problem is the includes keep changing their directory paths to images. so how do I link to images so that it is universally accepted througout the site, without using the http://www.mywebsite.com/images/.... way as this way takes longer for the webserver to process.
PHP And Active Directory
Via a PHP script (running on a LAMP configuration - PHP with LDAP support), I run queries on the LDAP server of our office (users and arguments). Now, I want to put the result of this query (user information) in a Windows 2003 AD. I use PHP-ldap functions to connect with the domain controller: making connection is no problem, but binding (authenticated, I even tried Domain Administrator credentials) doesn't work... Does anyone has experience with this matter (PHP and AD connection/communucation)?
IIS+PHP: The Directory Name Is Invalid.
I have recently migrated from win98+PWS to winXP+IIS, and after that an problem has occured. When I open some of my PHP pages, I get this instead of the page I shlud get: <html><head><title>Error</title></head><body>The directory name is invalid. </body></html> Now, the interesting part is the fact that this doesn't happen every time I try to open a specific page (it happens in 80% of cases, but sometimes it (the page) just opens like nothing's wrong) and that it happens on all of my PHP pages! I presume I have misconfigured IIS... but I don't know where to start searching for a problem... does IIS have logging? Does PHP have logging? Or, has anybody encountered similar problem? I use: IIS 5.1 PHP Version 4.3.0 IE 6.0
Finding Directory
would like to know if there is a way to locate a specific directory on your site. I have a script which scans a directory, but it is not always running in the same directory, so the relative path to the scanned directory will be changed. Is there a way to find the location of the directory to be scanned, and build a relative url to it?
Run PHP Scripts Outside Of The Web Directory
Is it possible to run a script that will be used from all the websites on the server outside of the web dir ? At the moment for every site I have I upload the script in the web dir of the specific site... Specifically it is a RichEditor so it has javascripts as well ... But it is difficult to maintain updates of the script to all websites so I would prefer if I had only one place to update it...
Getting Current Directory
Can anyone tell me how i can get php to retrieve the directory i am working from (Home Directory)the reason i ask is i am getting a directory listing of my images folder and i dont want to have to enter the complete path to that directory (C:lahdahimages) i want to be able to just enter the images folder as my folder to retrieve.
Current Directory
Anyone know that how to find the current directory's name in php? I need the php automatic to find its current directory's name.
Php Directory Structure
im a little worried about security in a site im designing and have a proposition.. i thought about keeping every single php and inc file in a directory beneath the web directory.. such that NONE of the files can be accessed from a web browser.. then.. when a user requests, for example, to use the built in login page which is entitled login.php.. i simply use apache to forward this page login.php in a different directory.. i can as well use mod rewrite to accomplish similar things.. im trying to think of the reasons that something like this would NOT be a good idea.. i imagine i could create all the php files in a seperate folder on the same level, perhaps title pseudoWWW, and have the entire web strucutre of phps' and incs' in there, and then, when someone requests www/login.html, it doesnt have to have a specific directive in apache to go to login.php, rather, go to the file in the pseudo directory with the same name, but a php extension, run the script, output the results.. then the user wouldn't have any idea that the php script even exists, let alone where it is and what it's doing.
Creating Directory
i've stored as "MPEG PAL" in a string variable say $directory.(i've tested using is_string() function).Now when creating a directory using exec(mkdir $directory); it creates two directories MPEG and PAL. I need these two to be a single directory MPEG PAL. How can i do it.i've stored into $directory from text box.
|