Advertisement

08.18.2008 at 07:11PM PDT, ID: 23658342
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.8

Perl version of Mass copy overwrite

Asked by Simon336697 in Perl Programming Language

Hi everyone, hope you are all well :>)

Guys i have the following question.

I have a template file that I wish to use against a list of files.

Id like to be able to do the following in 2 different ways, using perl as the solution.

###########
SCENARIO 1:  <script>.pl <file_list.txt>
###########
Use a text file with a list of files, as a parameter and use the template file to copy and overwrite each file in this file list:
-------------------------------------------------------------------------------------------------------------------------------

For example:

I have a file called 'file_list.txt' which contains the following:

------------------------------------------------------------------------------------- file_list.txt
menu4_about_howsimeswikiworks_miscellaneous_focusHERE.php
menu4_about_howsimeswikiworks_structure_focusHERE.php
menu4_about_mesimon_miscellaneous_focusHERE.php
menu4_about_mylinuxserver_configuration_focusHERE.php
menu4_about_phpperformance_apc_focusHERE.php
menu4_about_thissite_backingup_focusHERE.php

What id like the script to do is as follows:

<script>.pl  file_list.txt

For each file mentioned in file_list.txt,  copy  /var/www/html/simeswiki/templates/menu123_or_4_x.php to each of these files, and dont prompt to overwrite, just do it for each one.

Something like:

<script>.pl   file_list.txt
For each file in file_list.txt
cp /var/www/html/simeswiki/menu123_or_4_x.php  <each_file_in_file_list.txt>


###########
SCENARIO 2:  <script>.pl  <search_criteria_generating_files_for_the_script_to_act_against>
###########

In this scenario, this is similar to doing a dir <criteria>

So,

<script>.pl /var/www/html/simeswiki/*focusHERE*

would

a) find a list of all files in /var/www/html/simeswiki of name *focusHERE*, and
b) for each one,

cp /var/www/html/simeswiki/menu123_or_4_x.php  <for_each_file_of_name_*focusHERE*_in_/var/www/html/simeswiki_>

Hope this makes sense.

Any help appreciated. :>)
Start Free Trial
[+][-]08.19.2008 at 07:17AM PDT, ID: 22259988

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 14-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]08.19.2008 at 07:31AM PDT, ID: 22260153

View this solution now by starting your 14-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Perl Programming Language
Sign Up Now!
Solution Provided By: Adam314
Participating Experts: 2
Solution Grade: A
 
 
[+][-]08.20.2008 at 06:04AM PDT, ID: 22268912

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 14-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20081112-EE-VQP-43 / EE_QW_2_20070628