PHP
  Home arrow PHP arrow Page 3 - Stream Me Up, Scotty (part 2)
Dev Shed Forums 
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Forums Sitemap 
IBM® developerWorks 
Sun Developer Network 
Dedicated Servers 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Moblin 
JMSL Numerical Library 
VPS Hosting 
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
PHP

Stream Me Up, Scotty (part 2)
By: Vikram Vaswani, (c) Melonfire
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 2
    2000-11-29

    Table of Contents:
  • Stream Me Up, Scotty (part 2)
  • Looking Around
  • To Create And Destroy
  • Upsa-daisy!
  • Remote Control
  • The Application

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Stream Me Up, Scotty (part 2) - To Create And Destroy


    (Page 3 of 6 )

    Next up, a little file and directory manipulation. If you'd like to create directories, PHP provides the mkdir() function, which accepts a file path and a mode as parameters, So, if I wanted to create a directory called "/tmp/me" with permissions 755, I would use something like this:

    <? if (mkdir ("/tmp/me", 0755)) { echo "Successful!"; } else { echo "Unsuccessful"; } ?>
    And to reverse the process, there's always the rmdir() function, used to delete directories. Note that rmdir() will fail if the directory permissions don't allow deletion, or if the directory contains one or more files.

    <? if (rmdir ("/tmp/me")) { echo "Successful!"; } else { echo "Unsuccessful - check permissions and ensure directory is empty!"; } ?>
    You can delete files with the unlink() function, which accepts a filename as parameter. <? if (unlink("/tmp/dummyfile")) { echo "Successful!"; } else { echo "Unsuccessful!"; } ?>
    
     And finally, you can copy files with the copy() function, 

    <? if (copy("/tmp/source", "/tmp/destination")) { echo "Successful!"; } else { echo "Unsuccessful!"; } ?>
    and rename (or move) them with the rename() function.

    <? if (rename("/tmp/oldfile", "/etc/newfile")) { echo "Successful!"; } else { echo "Unsuccessful!"; } ?>


    This article copyright Melonfire 2000. All rights reserved.

    More PHP Articles
    More By Vikram Vaswani, (c) Melonfire


     

       

    PHP ARTICLES

    - Paginating Database Records with the Code Ig...
    - HTTP Headers in Web Development
    - Project Management: Administration
    - Building a Database-Driven Application with ...
    - User Authentication for a Project Management...
    - Introduction to the CodeIgniter PHP Framework
    - Adding Users for a Project Management Applic...
    - Migrating Class Code for a MIME Email to PHP...
    - Login and Logout Authentication for a Projec...
    - Composing Messages in HTML for MIME Email wi...
    - Project Management: Authentication
    - A Better Way to Determine MIME Types for MIM...
    - Project Management Overview
    - Handling Attachments in MIME Email with PHP
    - Completing the Project Management Application





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway