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
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |