SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Thread: Move command

  1. #1
    SitePoint Addict
    Join Date
    Jun 2008
    Posts
    205
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Move command

    The move command does'nt execute on the file below.<br />
    Is it because there is a '&' sign in between?<br />

    How to solve the problem if '&' exists in filename.

    Code:
    #!/usr/bin/perl
    $filename = 'new&name.txt';
    `mv $filename new&filename_renamed.txt`;

    On execution gives out the message as below


    Code:
    sh: name.txt: command not found
    sh: filename_renamed.txt: command not found
    mv: missing file argument
    Try `mv --help' for more information.
    [2]   Done(127)               name.txt new

  2. #2
    SitePoint Wizard bronze trophy KevinR's Avatar
    Join Date
    Nov 2004
    Location
    Moon Base Alpha
    Posts
    1,053
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    mv is not a perl command so you should ask on a Linux or Unix forum why its not working. You could use the File::Copy module that comes with perl or try the rename() function instead of shelling out to the mv command.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •