Web Developer's Virtual Library: Encyclopedia of Web Design Tutorials, Articles and Discussions


WDVL Newsletter

Active Server Pages
JSP/Java Servlets
Microsoft SQL Server
Daily Backup
Dedicated Servers
Streaming Audio/Video
24-hour Support    

jobs.webdeveloper.com

Hiermenus


e-commerce
Partner With Us















Developer Channel
FlashKit.com
JavaScript.com
JavaScriptSource
Developer Jobs
ScriptSearch
StreamingMediaWorld
Web Developer's Journal
Web Developer's Virtual Library
WebDeveloper.com
Webreference
Web Hosts
XMLfiles.com

internet.com
IT
Developer
Internet News
Small Business
Personal Technology

Search internet.com
Advertise
Corporate Info
Newsletters
Tech Jobs
E-mail Offers


Deleting, Renaming and Changing the Permissions of Files

Deleting, Renaming and Changing the Permissions of Files

  • Perl also provides you with all of the file management functions typically offered by your operating system. In my experience, the three most utilized functions in CGI scripts are unlink, rename and chmod. unlink is Perl's function for deleting a file from the file system. The syntax is pretty straight forward.

    unlink ("[filename]"); 
    

  • This line of Perl code will delete the file called filename provided that the script has permissions to delete the file.

  • Your Perl script can also rename a file using the rename function:

    rename ("[old_filename]", "[new_filename]"); 
    

  • In this case, the file's name will be replaced with the new filename specified.

  • Finally, Perl gives you the ability to affect the permissions of files in the file system using the chmod function. The syntax is also fairly straight forward as follows:

    chmod (0666, "filename"); 
    

  • In this case, "filename" will be made readable and writable by user, group and world.

Additional Resources:

Writing and Appending to Files
Table of Contents
File Tests


Up to => Home / Authoring / Scripting / Tutorial




Jupiter Online Media: internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and Jupiter Online Media

Jupitermedia Corporate Info


Legal Notices, Licensing, & Permissions, Privacy Policy.

Web Hosting | Newsletters | Tech Jobs | Shopping | E-mail Offers