G'day ObiPanda,

The glob() doco shows some special cases of using single and double quotes. You should tell us if you're dealing with such special cases.

I see nothing in File::Copy where move() takes an arrayref as a first argument.

I created some dummy files under ~/tmp/pm_11154302_move_files and a test script, move_to_phone.pl, to show usage.

#!/usr/bin/env perl use strict; use warnings; use File::Copy 'move'; my ($src, $dest) = qw{Temp Phone}; mv_tmp_to_phone($src, $dest); sub mv_tmp_to_phone { my ($src, $dest) = @_; system ls => '-lR'; my @files = glob("$src/*"); print "$_\n" for @files; move($_, $dest) for @files; system ls => '-lR'; }

Here's a sample run:

ken@titan ~/tmp/pm_11154302_move_files $ ./move_to_phone.pl .: total 1 -rwxr-xr-x 1 ken None 337 Sep 8 18:05 move_to_phone.pl drwxr-xr-x 1 ken None 0 Sep 8 17:49 Phone drwxr-xr-x 1 ken None 0 Sep 8 17:50 Temp ./Phone: total 0 ./Temp: total 0 -rw-r--r-- 1 ken None 0 Sep 8 17:50 file1 -rw-r--r-- 1 ken None 0 Sep 8 17:50 file2 Temp/file1 Temp/file2 .: total 1 -rwxr-xr-x 1 ken None 337 Sep 8 18:05 move_to_phone.pl drwxr-xr-x 1 ken None 0 Sep 8 18:05 Phone drwxr-xr-x 1 ken None 0 Sep 8 18:05 Temp ./Phone: total 0 -rw-r--r-- 1 ken None 0 Sep 8 17:50 file1 -rw-r--r-- 1 ken None 0 Sep 8 17:50 file2 ./Temp: total 0

Please try something along those lines. If it doesn't work for you, advise us of sample filenames. An SSCCE would greatly help if you need further assistance.

— Ken


In reply to Re: how to move multiple files by kcott
in thread how to move multiple files by ObiPanda

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.