Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Backup files from different directories with the same name problem Post 303045526 by dampio on Monday 30th of March 2020 11:26:24 AM
Old 03-30-2020
Backup files from different directories with the same name problem

Hi, I have tried multiple ways to solve this with no success, unfortunately.

I have a variable like this:
echo $var
/etc/tomcat/server.xml /etc/tomcat/test/server.xml

How can I backup both files from this variable with different names? I tried setting it as an array var2=($var) but it only shows the first file.

Thanks in advance for te help.
 

9 More Discussions You Might Find Interesting

1. Solaris

How to backup /home directories?

I know that how to backup the home directories in sun sparc server. Firstly, umount the filesystem, Secondly, fsck the filesystem, Thirdly, ufsdump the filesystem. Anybody know how to type the full command line backup the /home directory? (1 Reply)
Discussion started by: kingsan
1 Replies

2. Windows & DOS: Issues & Discussions

Backup Directories and SubDirectories with log using DOS

Hello. I need to Backup an Directorie with Sub-directories and after that put in a log file. Then i need to copy several files and have a log file to. All that using old DOS. Could someone help ? Thanks in advance (1 Reply)
Discussion started by: osramos
1 Replies

3. Shell Programming and Scripting

[problem] making a backup files

Hi guys, I'm a little stuck on this problem, I've tried googling it and some trial and error but can't seem to get it working. Basically I need the script to: 1) create a directory called "mybackups", if it doesn't exist 2) go through all the .sh files in the current directory, and copy... (4 Replies)
Discussion started by: chazij
4 Replies

4. Shell Programming and Scripting

backup of directories and subdirectories

Hello I'm new to the area Bash scripting and that is why I have a search script that is run on my unix server and always when I start the server or every 24 hours The script will create backups of directories and subdirectories I never found what I'm here make a new thread ... (1 Reply)
Discussion started by: HansWurst
1 Replies

5. Shell Programming and Scripting

Find all .htaccess files and make a backup copy in respective directories

Hey guys, I need to know how to locate all .htaccess files on the server and make a backup of them in the folder they reside before I run a script to modify all of them. So basically taking dir1/.htaccess and copying it as dir1/.htaccess_bk dir2/.htaccess copying as dir2/.htaccess_bk... (5 Replies)
Discussion started by: boxx
5 Replies

6. Shell Programming and Scripting

How to list all the files, directories and sub-directories in the current path except one directory?

Can anyone come up with a unix command that lists all the files, directories and sub-directories in the current directory except a folder called log.? Thank you in advance. (7 Replies)
Discussion started by: Manjunath B
7 Replies

7. Shell Programming and Scripting

Archiving and moving files into directories, creating directories, etc.

how can i move "dataName".sql.gz into a folder called 'database' and then move "$fileName".tar.gz * .htaccess into a folder called 'www' with the entire gzipped file being "$fileName".tar.gz? Is this doable or overly complex. so mydemo--2015-03-23-1500.tar.gz > database -... (5 Replies)
Discussion started by: wyclef
5 Replies

8. Debian

Problem with maximum files and directories

Hi, I'm using Kali linux, I think it's a debian linux ? I'm trying to create a folder in which there'll be 256 folders, and in each of this folders there will also be 256 folders. Then in each terminate folders I want to create 4096 files. It will look like /dir/aa/aa/aaa.txt,... (3 Replies)
Discussion started by: ganon551
3 Replies

9. AIX

How to backup a directory (sub-directories/files) files from one server on to other ?

Hello, Server A: /directory1/ Server B: /Backups/ i wanted to backup contents of /directory1 from "server A" on to "Server B" every 1 hour. If there is any change in (only new/differences) contents on serverA (directory1/) supposed to be backeup on next run. I did used rsync command to... (5 Replies)
Discussion started by: System Admin 77
5 Replies
XSLT_PROCESS(3) 							 1							   XSLT_PROCESS(3)

xslt_process - Perform anXSLTtransformation

SYNOPSIS
mixed xslt_process (resource $xh, string $xmlcontainer, string $xslcontainer, [string $resultcontainer], [array $arguments], [array $parameters]) DESCRIPTION
The xslt_process(3) function is the crux of the XSLT extension. It allows you to perform an XSLT transformation using almost any type of input source - the containers. This is accomplished through the use of argument buffers -- a concept taken from the SablotronXSLT processor (currently the only XSLT processor this extension supports). The input containers default to a filename 'containing' the document to be processed. PARAMETERS
o $ xh -The XSLT processor link identifier, created with xslt_create(3). o $xmlcontainer - Path to XML file or placeholder for the XML argument. o $xslcontainer - Path to XSL file or placeholder for the XML argument. o $resultcontainer - The result container defaults to a filename for the transformed document. If the result container is not specified - i.e. NULL - than the result is returned. o $arguments - Instead of files as the XML and XSLT arguments to the xslt_process(3) function, you can specify "argument place holders" which are then substituted by values given in the $arguments array. o $parameters - An array for any top-level parameters that will be passed to the XSLT document. These parameters can then be accessed within your XSL files using the <xsl:param name="parameter_name"> instruction. The parameters must be UTF-8 encoded and their values will be interpreted as strings by the Sablotron processor. In other words - you cannot pass node-sets as parameters to the XSLT docu- ment. Containers can also be set via the $arguments array (see below). RETURN VALUES
Returns TRUE on success or FALSE on failure. If the result container is not specified - i.e. NULL - than the result is returned. CHANGELOG
+--------+---------------------------------------------------+ |Version | | | | | | | Description | | | | +--------+---------------------------------------------------+ | 4.0.6 | | | | | | | This function no longer takes XML strings in | | | $xmlcontainer or $xslcontainer. Passing a string | | | containing XML to either of these parameters will | | | result in a segmentation fault in Sablotron ver- | | | sions up to and including version 0.95. | | | | +--------+---------------------------------------------------+ EXAMPLES
The simplest type of transformation with the xslt_process(3) function is the transformation of an XML file with an XSLT file, placing the result in a third file containing the new XML (or HTML) document. Doing this with Sablotron is really quite easy... Example #1 Using the xslt_process(3) to transform an XML file and a XSL file to a new XML file <?php // Allocate a new XSLT processor $xh = xslt_create(); // Process the document if (xslt_process($xh, 'sample.xml', 'sample.xsl', 'result.xml')) { echo "SUCCESS, sample.xml was transformed by sample.xsl into result.xml"; echo ", result.xml has the following contents <br /> "; echo "<pre> "; readfile('result.xml'); echo "</pre> "; } else { echo "Sorry, sample.xml could not be transformed by sample.xsl into"; echo " result.xml the reason is that " . xslt_error($xh) . " and the "; echo "error code is " . xslt_errno($xh); } xslt_free($xh); ?> While this functionality is great, many times, especially in a web environment, you want to be able to print out your results directly. Therefore, if you omit the third argument to the xslt_process(3) function (or provide a NULL value for the argument), it will automatically return the value of the XSLT transformation, instead of writing it to a file... Example #2 Using the xslt_process(3) to transform an XML file and a XSL file to a variable containing the resulting XML data <?php // Allocate a new XSLT processor $xh = xslt_create(); // Process the document, returning the result into the $result variable $result = xslt_process($xh, 'sample.xml', 'sample.xsl'); if ($result) { echo "SUCCESS, sample.xml was transformed by sample.xsl into the $result"; echo " variable, the $result variable has the following contents <br /> "; echo "<pre> "; echo $result; echo "</pre> "; } else { echo "Sorry, sample.xml could not be transformed by sample.xsl into"; echo " the $result variable the reason is that " . xslt_error($xh); echo " and the error code is " . xslt_errno($xh); } xslt_free($xh); ?> The above two cases are the two simplest cases there are when it comes to XSLT transformation and I'd dare say that they are the most com- mon cases, however, sometimes you get your XML and XSLT code from external sources, such as a database or a socket. In these cases you'll have the XML and/or XSLT data in a variable -- and in production applications the overhead of dumping these to file may be too much. This is where XSLT's "argument" syntax, comes to the rescue. Instead of files as the XML and XSLT arguments to the xslt_process(3) function, you can specify "argument place holders" which are then substituted by values given in the arguments array (5th parameter to the xslt_process(3) function). The following is an example of processing XML and XSLT into a result variable without the use of files at all. Example #3 Using the xslt_process(3) to transform a variable containing XML data and a variable containing XSL data into a variable containing the resulting XML data <?php // $xml and $xsl contain the XML and XSL data $arguments = array( '/_xml' => $xml, '/_xsl' => $xsl ); // Allocate a new XSLT processor $xh = xslt_create(); // Process the document $result = xslt_process($xh, 'arg:/_xml', 'arg:/_xsl', NULL, $arguments); if ($result) { echo "SUCCESS, sample.xml was transformed by sample.xsl into the $result"; echo " variable, the $result variable has the following contents <br /> "; echo "<pre> "; echo $result; echo "</pre> "; } else { echo "Sorry, sample.xml could not be transformed by sample.xsl into"; echo " the $result variable the reason is that " . xslt_error($xh); echo " and the error code is " . xslt_errno($xh); } xslt_free($xh); ?> Example #4 Passing PHP variables to XSL files <?php // XML string $xml = '<?xml version="1.0"?> <para> change me </para>'; // XSL string $xsl = ' <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="html" encoding="ISO-8859-1" indent="no" omit-xml-declaration="yes" media-type="text/html"/> <xsl:param name="myvar"/> <xsl:param name="mynode"/> <xsl:template match="/"> My PHP variable : <xsl:value-of select="$myvar"/><br /> My node set : <xsl:value-of select="$mynode"/> </xsl:template> </xsl:stylesheet>'; $xh = xslt_create(); // the second parameter will be interpreted as a string $parameters = array ( 'myvar' => 'test', 'mynode' => '<foo>bar</foo>' ); $arguments = array ( '/_xml' => $xml, '/_xsl' => $xsl ); echo xslt_process($xh, 'arg:/_xml', 'arg:/_xsl', NULL, $arguments, $parameters); ?> The above example will output: My PHP variable : test<br> My node set : &lt;foo&gt;bar&lt;/foo&gt; NOTES
Note Please note that file:// is needed in front of the path when using Windows. PHP Documentation Group XSLT_PROCESS(3)
All times are GMT -4. The time now is 04:37 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy