After spending some more time looking through this, you did explain it quite well. I just didn't read it as well as you explained it.
I am in the process of trying to copy the files that are found by this to a different location and not having much success. Probably the best solution would be to dump the sorted list into a bash array. Then I can do all the rest I need to do.
This is my attempt to do this (I didn't include that parsing and exception code here but will post the entire working script, once it is...)
This is mildly successful in that is does capture the file names in an array, but all of them are in the first array element. I suppose I could parse array[0] on out.txt, or something kludgey like that, but I am guessing there is a better way.
I know there are some ways to copy in awk, and also with system, but I need to extract some additional information from the filename to locate an additional file, and the only way I know how to do that is in bash.
Hello all
im using allot with the method of getting file list from misc place in unix and copy them into text file
and then doing misc action on this list of files using
foreach f (`cat file_list.txt`)
do something with $f
end
can I replace this file_list.txt with some place in memory? ... (1 Reply)
I have the files logged in the file system with names in the format of : filename_ordernumber_date_time
eg:
file_1_12012007_1101.txt
file_2_12022007_1101.txt
file_1_12032007_1101.txt
I need to find out all the files that are logged multiple times with same order number. In the above eg, I... (1 Reply)
Hi,
I have list of files as following:
/home/abc/x/23344.php
/home/axx/zz/ddddd/abc/7asda/2434.php
/home/zzz/7x/y/114.php
/home/assssc/x/yasyday/23664.php
( last part in each line is <somenumber.php>
I need to somehow get this from the above:
/home/abc/x/... (6 Replies)
Please see how can I do this:
File A (three columns):
X1,Y1,1.01
X2,Y2,2.02
X3,Y3,4.03
File B (three columns):
X1,Y1,1
X2,Y2,2
X3,Y3,4.0005
Now I have to compare file A and B based on the integer part of column 3. Means first 2 rows should be OK and the third row should not satisfy... (12 Replies)
Hi
i have a file which has mutiple line in it.
inside that i have a pattern similar to this
/abc/def/hij
i want to fine the pattern starting with "/" and get the first word in between the the symbols "/" i.e. "abc" in this case into a variable.
thanks in advance (13 Replies)
Hi Gurus,
I need to list only the files with out certain extension.
For eg from the following list of files:
I need to only list:
Thanks
Shash (7 Replies)
Hello,
I have a huge directory (with millions of files) and need to find out duplicates based on BOTH file name and File size.
I know fdupes but it calculates MD5 which is very time-consuming and especially it takes forever as I have millions of files.
Can anyone please suggest a script or... (7 Replies)
I am trying to modify the "corestat v1.1" code which is in Perl.The typical output of this code is below:
Core Utilization
CoreId %Usr %Sys %Total
------ ----- ----- ------
5 4.91 0.01 4.92
6 0.06 ... (0 Replies)
Hi,
I have a directory with a lot of files like this:
a.bam
b.bam
c.bam
I like to rename these files based on a list where the name of the files in the first column will be replasced by the names in the second column. Here is my list which is a tab-delimited text file:
a x
b y
c ... (4 Replies)
I have a expect file like this
#!/opt/tools/unsupported/expect-5.39/bin/expect
spawn ssh -l user ip
expect_after eof {exit 0}
set timeout 10
log_file /report.txt
expect "Password:" { send "pasword\r" }
expect "$ " { send "date\r" }
expect "$ " { send "readlink /somelink\r" }
set... (7 Replies)
Discussion started by: bebehnaz
7 Replies
LEARN ABOUT PHP
phar.extractto
PHAR.EXTRACTTO(3) 1 PHAR.EXTRACTTO(3)Phar::extractTo - Extract the contents of a phar archive to a directory
SYNOPSIS
public bool Phar::extractTo (string $pathto, [string|array $files], [bool $overwrite = false])
DESCRIPTION
Note
This method requires the php.ini setting phar.readonly to be set to 0 in order to work for Phar objects. Otherwise, a PharException
will be thrown.
Extract all files within a phar archive to disk. Extracted files and directories preserve permissions as stored in the archive. The
optional parameters allow optional control over which files are extracted, and whether existing files on disk can be overwritten. The sec-
ond parameter files can be either the name of a file or directory to extract, or an array of names of files and directories to extract. By
default, this method will not overwrite existing files, the third parameter can be set to true to enable overwriting of files. This method
is similar to ZipArchive.extractTo(3).
PARAMETERS
o $pathto
- Path within an archive to the file to delete.
o $files
- The name of a file or directory to extract, or an array of files/directories to extract
o $overwrite
- Set to TRUE to enable overwriting existing files
RETURN VALUES
returns TRUE on success, but it is better to check for thrown exception, and assume success if none is thrown.
ERRORS /EXCEPTIONS
Throws PharException if errors occur while flushing changes to disk.
EXAMPLES
Example #1
A Phar.extractTo(3) example
<?php
try {
$phar = new Phar('myphar.phar');
$phar->extractTo('/full/path'); // extract all files
$phar->extractTo('/another/path', 'file.txt'); // extract only file.txt
$phar->extractTo('/this/path',
array('file1.txt', 'file2.txt')); // extract 2 files only
$phar->extractTo('/third/path', null, true); // extract all files, and overwrite
} catch (Exception $e) {
// handle errors
}
?>
SEE ALSO PharData.extractTo(3).
PHP Documentation Group PHAR.EXTRACTTO(3)