Copy file recursively

2009-03-05 Thread Rock Lifestyle
Hi ,
 
 My directory structure is like 
 
ls -R temp
temp:
2.1  2.2  cleanup  setup
 
temp/2.1:
2.1.1    cleanup  setup
 
temp/2.1/2.1.1:
  setup cleanup 2.1.1.01  2.1.1.02  2.1.1.03  2.1.1.04  2.1.1.05  2.1.1.06  
2.1.1.07  2.1.1.08
 
temp/2.1/2.1.1/2.1.1.01:
cleanup  setup    test
 
temp/2.1/2.1.1/2.1.1.02:
cleanup  setup    test
 
temp/2.1/2.1.1/2.1.1.03:
cleanup  setup    test
 
temp/2.1/2.1.1/2.1.1.04:
cleanup  setup    test
 
temp/2.1/2.1.1/2.1.1.05:
cleanup  setup    test
 
temp/2.1/2.1.1/2.1.1.06:
cleanup  setup    test
 
temp/2.1/2.1.1/2.1.1.07:
cleanup  setup    test
 
temp/2.1/2.1.1/2.1.1.08:
cleanup  setup    test
 
temp/2.2:
2.2.1    cleanup  setup
 
temp/2.2/2.2.1:
2.2.1.01  2.2.1.02  2.2.1.03  2.2.1.04  2.2.1.05  2.2.1.06  2.2..1.07  
2.2.1.08  2.2.1.09  2.2.1.10
 
temp/2.2/2.2.1/2.2.1.01:
test
 
temp/2.2/2.2.1/2.2.1.02:
setup  test
 
temp/2.2/2.2.1/2.2.1.03:
setup  test
 
temp/2.2/2.2.1/2.2.1.04:
setup  test
 
temp/2.2/2.2.1/2.2.1.05:
test
 
temp/2.2/2.2.1/2.2.1.06:
setup  test
 
temp/2.2/2.2.1/2.2.1.07:
setup  test
 
temp/2.2/2.2.1/2.2.1.08:
setup  test
 
temp/2.2/2.2.1/2.2.1.09:
setup  test
 
temp/2.2/2.2.1/2.2.1.10:
setup  test
 
 
I want to copy some subdirectory and files under it to another directory it 
should exactly create similar directory structure 
 
like if i will give temp
/2.2/2.2.1/2.2.1.10:
 
/2.2/2.2.1/2.2.1.08:
 
and
 
then it will create a directory destination/
 
ls -R  destination
 
destination:
2.2  cleanup  setup
 
destination/2.2:
2.2.1    cleanup  setup
 
destination/2.2/2.2.1/2.2.1.10:
setup  test
 
destination/2.2/2.2.1/2.2.1.08:
setup  test
 
means exact directory tree will all files
 
 
 


  Add more friends to your messenger and enjoy! Go to 
http://messenger.yahoo.com/invite/

Copy file recursively

2009-03-05 Thread Rock Lifestyle


--- On Thu, 5/3/09, Rock Lifestyle lifestyle.r...@yahoo.in wrote:


From: Rock Lifestyle lifestyle.r...@yahoo.in
Subject: Copy file recursively
To: beginners@perl.org
Date: Thursday, 5 March, 2009, 9:48 AM


Hi ,
 
 My directory structure is like 
 
ls -R temp
temp:
2.1  2.2  cleanup  setup
 
temp/2.1:
2.1.1    cleanup  setup
 
temp/2.1/2.1.1:
  setup cleanup 2.1.1.01  2.1.1.02  2.1.1.03  2.1.1.04  2.1.1.05  2.1.1.06  
2.1.1.07  2.1.1.08
 
temp/2.1/2.1.1/2.1.1.01:
cleanup  setup    test
 
temp/2.1/2.1.1/2.1.1.02:
cleanup  setup    test
 
temp/2.1/2.1.1/2.1.1.03:
cleanup  setup    test
 
temp/2.1/2.1.1/2.1.1.04:
cleanup  setup    test
 
temp/2.1/2.1.1/2.1.1.05:
cleanup  setup    test
 
temp/2.1/2.1.1/2.1.1.06:
cleanup  setup    test
 
temp/2.1/2.1.1/2.1.1.07:
cleanup  setup    test
 
temp/2.1/2.1.1/2.1.1.08:
cleanup  setup    test
 
temp/2.2:
2.2.1    cleanup  setup
 
temp/2.2/2.2.1:
2.2.1.01  2.2.1.02  2.2.1.03  2.2.1.04  2.2.1.05  2.2.1.06  2.2...1.07  
2.2.1.08  2.2.1.09  2.2.1.10
 
temp/2.2/2.2.1/2.2.1.01:
test
 
temp/2.2/2.2.1/2.2.1.02:
setup  test
 
temp/2.2/2.2.1/2.2.1.03:
setup  test
 
temp/2.2/2.2.1/2.2.1.04:
setup  test
 
temp/2.2/2.2.1/2.2.1.05:
test
 
temp/2.2/2.2.1/2.2.1.06:
setup  test
 
temp/2.2/2.2.1/2.2.1.07:
setup  test
 
temp/2.2/2.2.1/2.2.1.08:
setup  test
 
temp/2.2/2.2.1/2.2.1.09:
setup  test
 
temp/2.2/2.2.1/2.2.1.10:
setup  test
 
 
I want to copy some subdirectory and files under it to another directory it 
should exactly create similar directory structure 
 
like if i will give temp
/2.2/2.2.1/2.2.1.10:
 
/2.2/2.2.1/2.2.1.08:
 
and
 
then it will create a directory destination/
 
ls -R  destination
 
destination:
2.2  cleanup  setup
 
destination/2.2:
2.2.1    cleanup  setup
 
destination/2.2/2.2.1/2.2.1.10:
setup  test
 
destination/2.2/2.2.1/2.2.1.08:
setup  test
 
means exact directory tree will all files
 
 
 


      Add more friends to your messenger and enjoy! Go to 
http://messenger.yahoo.com/invite/


  Download prohibited? No problem. CHAT from any browser, without download. 
Go to http://in.webmessenger.yahoo.com/

Copy file recursively

2009-03-05 Thread Swayam
Hi ,

 My directory structure is like

ls -R temp
temp:
2.1  2.2  cleanup  setup

temp/2.1:
2.1.1cleanup  setup

temp/2.1/2.1.1:
  setup cleanup 2.1.1.01  2.1.1.02  2.1.1.03  2.1.1.04  2.1.1.05  2.1.1.06
2.1.1.07  2.1.1.08

temp/2.1/2.1.1/2.1.1.01:
cleanup  setuptest

temp/2.1/2.1.1/2.1.1.02:
cleanup  setuptest

temp/2.1/2.1.1/2.1.1.03:
cleanup  setuptest

temp/2.1/2.1.1/2.1.1.04:
cleanup  setuptest

temp/2.1/2.1.1/2.1.1.05:
cleanup  setuptest

temp/2.1/2.1.1/2.1.1.06:
cleanup  setuptest

temp/2.1/2.1.1/2.1.1.07:
cleanup  setuptest

temp/2.1/2.1.1/2.1.1.08:
cleanup  setuptest

temp/2.2:
2.2.1cleanup  setup

temp/2.2/2.2.1:
2.2.1.01  2.2.1.02  2.2.1.03  2.2.1.04  2.2.1.05  2.2.1.06  2.2..1.07
2.2.1.08  2.2.1.09  2.2.1.10

temp/2.2/2.2.1/2.2.1.01:
test

temp/2.2/2.2.1/2.2.1.02:
setup  test

temp/2.2/2.2.1/2.2.1.03:
setup  test

temp/2.2/2.2.1/2.2.1.04:
setup  test

temp/2.2/2.2.1/2.2.1.05:
test

temp/2.2/2.2.1/2.2.1.06:
setup  test

temp/2.2/2.2.1/2.2.1.07:
setup  test

temp/2.2/2.2.1/2.2.1.08:
setup  test

temp/2.2/2.2.1/2.2.1.09:
setup  test

temp/2.2/2.2.1/2.2.1.10:
setup  test


I want to copy some subdirectory and files under it to another directory it
should exactly create similar directory structure

like if i will give temp
/2.2/2.2.1/2.2.1.10:

/2.2/2.2.1/2.2.1.08:

and

then it will create a directory destination/

ls -R  destination

destination:
2.2  cleanup  setup

destination/2.2:
2.2.1cleanup  setup

destination/2.2/2.2.1/2.2.1.10:
setup  test

destination/2.2/2.2.1/2.2.1.08:
setup  test

means exact directory tree will all files


Copy file recursively

2009-03-05 Thread Swayam
Hi ,

 My directory structure is like

ls -R temp
temp:
2.1  2.2  cleanup  setup

temp/2.1:
2.1.1cleanup  setup

temp/2.1/2.1.1:
  setup cleanup 2.1.1.01  2.1.1.02  2.1.1.03  2.1.1.04  2.1.1.05  2.1.1.06
2.1.1.07  2.1.1.08

temp/2.1/2.1.1/2.1.1.01:
cleanup  setuptest

temp/2.1/2.1.1/2.1.1.02:
cleanup  setuptest

temp/2.1/2.1.1/2.1.1.03:
cleanup  setuptest

temp/2.1/2.1.1/2.1.1.04:
cleanup  setuptest

temp/2.1/2.1.1/2.1.1.05:
cleanup  setuptest

temp/2.1/2.1.1/2.1.1.06:
cleanup  setuptest

temp/2.1/2.1.1/2.1.1.07:
cleanup  setuptest

temp/2.1/2.1.1/2.1.1.08:
cleanup  setuptest

temp/2.2:
2.2.1cleanup  setup

temp/2.2/2.2.1:
2.2.1.01  2.2.1.02  2.2.1.03  2.2.1.04  2.2.1.05  2.2.1.06  2.2...1.07
2.2.1.08  2.2.1.09  2.2.1.10

temp/2.2/2.2.1/2.2.1.01:
test

temp/2.2/2.2.1/2.2.1.02:
setup  test

temp/2.2/2.2.1/2.2.1.03:
setup  test

temp/2.2/2.2.1/2.2.1.04:
setup  test

temp/2.2/2.2.1/2.2.1.05:
test

temp/2.2/2.2.1/2.2.1.06:
setup  test

temp/2.2/2.2.1/2.2.1.07:
setup  test

temp/2.2/2.2.1/2.2.1.08:
setup  test

temp/2.2/2.2.1/2.2.1.09:
setup  test

temp/2.2/2.2.1/2.2.1.10:
setup  test


I want to copy some subdirectory and files under it to another directory it
should exactly create similar directory structure

like if i will give temp
/2.2/2.2.1/2.2.1.10:

/2.2/2.2.1/2.2.1.08:

and

then it will create a directory destination/

ls -R  destination

destination:
2.2  cleanup  setup

destination/2.2:
2.2.1cleanup  setup

destination/2.2/2.2.1/2.2.1.10:
setup  test

destination/2.2/2.2.1/2.2.1.08:
setup  test

means exact directory tree will all files


Re: Copy file recursively

2009-03-05 Thread Swayam
On Thu, Mar 5, 2009 at 6:06 PM, Swayam swaya...@gmail.com wrote:

 Hi ,

  My directory structure is like

 ls -R temp
 temp:
 2.1  2.2  cleanup  setup

 temp/2.1:
 2.1.1cleanup  setup

 temp/2.1/2.1.1:
   setup cleanup 2.1.1.01  2.1.1.02  2.1.1.03  2.1.1.04  2.1.1.05  2.1.1.06
 2.1.1.07  2.1.1.08

 temp/2.1/2.1.1/2.1.1.01 http://2.1.1.1/:
 cleanup  setuptest

 temp/2.1/2.1.1/2.1.1.02 http://2.1.1.2/:
 cleanup  setuptest

 temp/2.1/2.1.1/2.1.1.03 http://2.1.1.3/:
 cleanup  setuptest

 temp/2.1/2.1.1/2.1.1.04 http://2.1.1.4/:
 cleanup  setuptest

 temp/2.1/2.1.1/2.1.1.05 http://2.1.1.5/:
 cleanup  setuptest

 temp/2.1/2.1.1/2.1.1.06 http://2.1.1.6/:
 cleanup  setuptest

 temp/2.1/2.1.1/2.1.1.07 http://2.1.1.7/:
 cleanup  setuptest

 temp/2.1/2.1.1/2.1.1.08:
 cleanup  setuptest

 temp/2.2:
 2.2.1cleanup  setup

 temp/2.2/2.2.1:
 2.2.1.01  2.2.1.02  2.2.1.03  2.2.1.04  2.2.1.05  2.2.1.06  2.2...1.07
 2.2.1.08  2.2.1.09  2.2.1.10

 temp/2.2/2.2.1/2.2.1.01 http://2.2.1.1/:
 test

 temp/2.2/2.2.1/2.2.1.02 http://2.2.1.2/:
 setup  test

 temp/2.2/2.2.1/2.2.1.03 http://2.2.1.3/:
 setup  test

 temp/2.2/2.2.1/2.2.1.04 http://2.2.1.4/:
 setup  test

 temp/2.2/2.2.1/2.2.1.05 http://2.2.1.5/:
 test

 temp/2.2/2.2.1/2.2.1.06 http://2.2.1.6/:
 setup  test

 temp/2.2/2.2.1/2.2.1.07 http://2.2.1.7/:
 setup  test

 temp/2.2/2.2.1/2.2.1.08:
 setup  test

 temp/2.2/2.2.1/2.2.1.09:
 setup  test

 temp/2.2/2.2.1/2.2.1.10:
 setup  test


 I want to copy some subdirectory and files under it to another directory it
 should exactly create similar directory structure

 like if i will give temp
 /2.2/2.2.1/2.2.1.10:

 /2.2/2.2.1/2.2.1.08:

 and

 then it will create a directory destination/

 ls -R  destination

 destination:
 2.2  cleanup  setup

 destination/2.2:
 2.2.1cleanup  setup

 destination/2.2/2.2.1/2.2.1.10:
 setup  test

 destination/2.2/2.2.1/2.2.1.08:
 setup  test

 means exact directory tree will all files





Re: Copy file recursively

2009-03-05 Thread Jim Gibson
On 3/5/09 Thu  Mar 5, 2009  1:48 AM, Rock Lifestyle
lifestyle.r...@yahoo.in scribbled:

 Hi ,
  
  My directory structure is like
  

[snipped]

  
 I want to copy some subdirectory and files under it to another directory it
 should exactly create similar directory structure

Use the File::Find and File::Copy modules. You will have to test each
directory entry to see if it is a file or a directory and, if it is a
directory, create it with Perl's mkdir function, or, if it is a file, copy
it with the copy command provided by File::Copy.

If you have trouble, post your program here and someone will be able to help
you.




--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: Copy file recursively

2009-03-05 Thread Octavian Râşniţă

Hi,

Use File::Copy::Recursive:

NAME
   File::Copy::Recursive - Perl extension for recursively copying files and
   directories

SYNOPSIS
 use File::Copy::Recursive qw(fcopy rcopy dircopy fmove rmove dirmove);

 fcopy($orig,$new[,$buf]) or die $!;
 rcopy($orig,$new[,$buf]) or die $!;
 dircopy($orig,$new[,$buf]) or die $!;

 fmove($orig,$new[,$buf]) or die $!;
 rmove($orig,$new[,$buf]) or die $!;
 dirmove($orig,$new[,$buf]) or die $!;

 rcopy_glob(orig/stuff-*, $trg [, $buf]) or die $!;
 rmove_glob(orig/stuff-*, $trg [,$buf]) or die $!;

DESCRIPTION
   This module copies and moves directories recursively (or single files,
   well... singley) to an optional depth and attempts to preserve each file
   or directory's mode.

Octavian

- Original Message - 
From: Swayam swaya...@gmail.com

To: beginners@perl.org
Sent: Thursday, March 05, 2009 4:44 PM
Subject: Copy file recursively



Hi ,

My directory structure is like

ls -R temp
temp:
2.1  2.2  cleanup  setup

temp/2.1:
2.1.1cleanup  setup

temp/2.1/2.1.1:
 setup cleanup 2.1.1.01  2.1.1.02  2.1.1.03  2.1.1.04  2.1.1.05  2.1.1.06
2.1.1.07  2.1.1.08

temp/2.1/2.1.1/2.1.1.01:
cleanup  setuptest

temp/2.1/2.1.1/2.1.1.02:
cleanup  setuptest

temp/2.1/2.1.1/2.1.1.03:
cleanup  setuptest

temp/2.1/2.1.1/2.1.1.04:
cleanup  setuptest

temp/2.1/2.1.1/2.1.1.05:
cleanup  setuptest

temp/2.1/2.1.1/2.1.1.06:
cleanup  setuptest

temp/2.1/2.1.1/2.1.1.07:
cleanup  setuptest

temp/2.1/2.1.1/2.1.1.08:
cleanup  setuptest

temp/2.2:
2.2.1cleanup  setup

temp/2.2/2.2.1:
2.2.1.01  2.2.1.02  2.2.1.03  2.2.1.04  2.2.1.05  2.2.1.06  2.2..1.07
2.2.1.08  2.2.1.09  2.2.1.10

temp/2.2/2.2.1/2.2.1.01:
test

temp/2.2/2.2.1/2.2.1.02:
setup  test

temp/2.2/2.2.1/2.2.1.03:
setup  test

temp/2.2/2.2.1/2.2.1.04:
setup  test

temp/2.2/2.2.1/2.2.1.05:
test

temp/2.2/2.2.1/2.2.1.06:
setup  test

temp/2.2/2.2.1/2.2.1.07:
setup  test

temp/2.2/2.2.1/2.2.1.08:
setup  test

temp/2.2/2.2.1/2.2.1.09:
setup  test

temp/2.2/2.2.1/2.2.1.10:
setup  test


I want to copy some subdirectory and files under it to another directory 
it

should exactly create similar directory structure

like if i will give temp
/2.2/2.2.1/2.2.1.10:

/2.2/2.2.1/2.2.1.08:

and

then it will create a directory destination/

ls -R  destination

destination:
2.2  cleanup  setup

destination/2.2:
2.2.1cleanup  setup

destination/2.2/2.2.1/2.2.1.10:
setup  test

destination/2.2/2.2.1/2.2.1.08:
setup  test

means exact directory tree will all files




--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/