Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I copy a directory except for all of the hidden files in Perl?

Tags:

perl

I have a directory hierarchy with a bunch of files. Some of the directories start with a .. I want to copy the hierarchy somewhere else, leaving out all files and dirs that start with a .

How can one do that?

like image 288
Lucas Meijer Avatar asked Feb 28 '23 17:02

Lucas Meijer


1 Answers

I think what you want is File::Copy::Recursive's rcopy_glob():

rcopy_glob()

This function lets you specify a pattern suitable for perl's glob() as the first argument. Subsequently each path returned by perl's glob() gets rcopy()ied.

It returns and array whose items are array refs that contain the return value of each rcopy() call.

It forces behavior as if $File::Copy::Recursive::CPRFComp is true.

like image 180
NO WAR WITH RUSSIA Avatar answered May 09 '23 00:05

NO WAR WITH RUSSIA