iLTC Home
Bookmark iLTC!
iLTC Google Boards

Categories

Perl
  • Perl Tutorials Beginners

    Javascript
  • Javascript Tutorials
  • Javascript Tutorials Beginners

    HTML
  • HTML Tutorials



  • iLoveTheCode.com
    Perl > Perl Tutorials How To Easy > Renaming a File with Perl's RENAME Function

    Renaming a File with Perl's RENAME Function



    To rename the file city.txt to citynames.txt

    rename("city.txt", "citynames.txt");

    You can move the file as well by specifying the path, but BE CAREFUL. A file with the same name where you are moving to, will be overwritten.

    rename("city.txt", "citydata/citynames.txt");

    The above would move city.txt to directory citydata as it renamed to citynames.txt


    Copy and Paste Perl Code:

    #!/usr/bin/perl

    print "Content-type:text/html\n\n";

    rename("city.txt", "citynames.txt") || print "Don't have permission to rename.<br><br>";

    print "Done";

    exit;

    Rename Perl Function - Test


    Click HERE to comment or discuss at iLoveTheCode GOOGLE Group
    Previous Article: OPEN and WRITE a Data File in Perl
    Next Article: Redirect to a Different URL in Perl





    Learning Web DesignLearning Web Design

    Jennifer Niederst ...

    New $29.69

    Head First HTML with CSS...Head First HTML with CSS & XHTML

    Eric Freeman, Elis...

    New $26.39

    CSSCSS

    David McFarland

    New $23.09

    CSSCSS

    Eric Meyer

    New $29.69

    Head First AjaxHead First Ajax

    Rebecca Riordan

    New $29.69

    JavaScriptJavaScript

    David Flanagan

    New $31.49

    HTML, XHTML, and CSS All...HTML, XHTML, and CSS All-in-One Desk...

    Andy Harris, Chris...

    New $23.09

    Beginning Joomla!Beginning Joomla!

    Dan Rahmel

    New $29.69


    Of Interest:
  • Create or Put Items into an Array in Perl
  • To Reverse an Array in Perl
  • OPEN and WRITE a Data File in Perl
  • Write a FOR LOOP in Perl
  • Opening an Alert Box in Javascript
  • Make Text Blink Using Javascript
  • Create a Function in Javascript
  • Get String Length with Javascript
  • Make a Line Return Using HTML
  • HTML Font Code
  • Make Strikethrough Text Using HTML
  • HTML Color Codes

  • More Articles:
  • Encryption with the Crypt Function in Perl
  • Create an Array of Specific Numbers in Perl
  • Check for Existing File in Perl
  • OPEN and READ a Data File in Perl
  • onClick Javascript
  • If, Else If, and Else in Javascript
  • Getting Epoch Time in Javascript
  • Match with a Regular Expression, REGEX, in Javascript
  • Use innerHTML to Change Text on a Page
  • HTML Title Tag
  • Make Text Bold Using HTML
  • HTML Tables
  • HTML Center

  • Search iLTC w/ Google





    Recent Articles

  • Javascript Focus Form Field
  • Javascript Lowercase Text
  • Javascript Uppercase Text
  • Javascript Superscript Text
  • Javascript Subscript Text
  • Make Text Blink Using Javascript
  • Make a String into a Link in Javascript
  • Javascript Italics Text
  • Javascript Bold Text
  • Javascript Redirect
  • HTML Frames
  • HTML Color Chart
  • HTML Link
  • Javascript Status Bar








  • Perl Programming - Javascript Programming - Maybe Some PHP - Free Scripts - ILoveTheCode
    All Content © 2006 iLoveTheCode.com


    Contact Chris | About this Site


    581,354
    Counter by iLoveTheCode.com


    Last Modified: Friday, 23-Jun-2006 07:23:17 EDT