Hello,
Today, as a root user, i want to copy recursively all files and diretories in a source directory to a destination directory using the following command,
cp -r /home/smith/* /home/bob/
However, I carelessly missed the '*' out when I executed the command.
Now, i noticed a... (1 Reply)
Hi Gurus,
I had a question regarding avoiding duplicates.i have a file abc.txt
abc.txt
-------
READER_1_1_1> HIER_28056 XML Reader: Error occurred while parsing:; line number ; column number
READER_1_3_1> Sun Mar 23 23:52:48 2008
READER_1_3_1> HIER_28056 XML Reader: Error occurred while... (0 Replies)
I searched the forum, but there was different type of rename.
Hello.
I have files in folder.
Like:
xxxxxxxx1.html
or
xxxxxxxx2.txt
or
xxxxxxxx3.tar.gz
and how to rename or change file extension case to
xxxxxxxx1.htm
or
xxxxxxx2.TXT
or (5 Replies)
Hello guys,
I was looking for a shell script that removes all the special characters from the files and the subdirectories recursively. I could not locate it any more. Dose any body have a similar script that dose that?
Thanks for the help.
AV (0 Replies)
I made menu script for users so they can run other script without going in shell just from menu.
But i must control their input.
These are criteria:
Input must have 4 signs
First two signs are always lower case letters
Input shall not have some special signs just letters and numbers
... (1 Reply)
Hi. Let me start saying that i am kinda new to bash, and have few skills in programming. I've been advised to use bash to manipulate large .csv files. I've been able to do some data filtering using fors, grep and tail commands. That was kinda easy seeing examples. But now i need to do some hard... (1 Reply)
HI ! all
till date I usually rename file like this
n=201108290000
for file in *.nc; do
file_name=M.m.1.1.1.$n.ready
n=$(( $n+1 ))
mv $file $file_name
donebut in this case I have to rename file depending on basename of file, when I list files results like this, if there is leap... (6 Replies)
I have a special case that awk could be used but I do not have the skill. Trying to create a final output file (indel_parse.txt) that is created from using some information from each of the two files (attached).
parse rules:
The header is skipped FNR>1
1. 4 zeros after the NC_ (not... (2 Replies)
In the bash menu below if the variant that is inputted is in the format NM_004004.3:c.274G>T the below works perfectly. My question is if the variant inputted isNM_004004.3:-c.274G>T or NM_004004.3:+c.274G>T then the code as is will throw an error due to a biological issue. Is it possible to to... (1 Reply)
I am trying to rename files with spaces and other characters and not able to be successful.
FileNames:
UPLOAD REFERENCE.xls
UPLOAD MASS REFERENCE.XLS
find /UPLOAD REFERENCE/ -depth -type f -name "* *" -exec rename " " "_" "{}" ";"
The above one is successful to replace spaces... (1 Reply)
Discussion started by: eskay
1 Replies
LEARN ABOUT PHP
rar_open
RAR_OPEN(3) 1 RAR_OPEN(3)RarArchive::open - Open RAR archive
Object oriented style (method):
SYNOPSIS
publicstatic RarArchive RarArchive::open (string $filename, [string $password = NULL], [callable $volume_callback = NULL])
DESCRIPTION
Procedural style:
RarArchive rar_open (string $filename, [string $password = NULL], [callable $volume_callback = NULL])
Open specified RAR archive and return RarArchive instance representing it.
Note
If opening a multi-volume archive, the path of the first volume should be passed as the first parameter. Otherwise, not all files
will be shown. This is by design.
PARAMETERS
o $filename
- Path to the Rar archive.
o $password
- A plain password, if needed to decrypt the headers. It will also be used by default if encrypted files are found. Note that the
files may have different passwords in respect to the headers and among them.
o $volume_callback
- A function that receives one parameter - the path of the volume that was not found - and returns a string with the correct path
for such volume or NULL if such volume does not exist or is not known. The programmer should ensure the passed function doesn't
cause loops as this function is called repeatedly if the path returned in a previous call did not correspond to the needed volume.
Specifying this parameter omits the notice that would otherwise be emitted whenever a volume is not found; an implementation that
only returns NULL can therefore be used to merely omit such notices.
Warning
Prior to version 2.0.0, this function would not handle relative paths correctly. Use realpath(3) as a workaround.
RETURN VALUES
Returns the requested RarArchive instance or FALSE on failure.
CHANGELOG
+--------+-----------------------------+
|Version | |
| | |
| | Description |
| | |
+--------+-----------------------------+
| 3.0.0 | |
| | |
| | $volume_callback was added. |
| | |
+--------+-----------------------------+
EXAMPLES
Example #1
Object oriented style
<?php
$rar_arch = RarArchive::open('encrypted_headers.rar', 'samplepassword');
if ($rar_arch === FALSE)
die("Failed opening file");
$entries = $rar_arch->getEntries();
if ($entries === FALSE)
die("Failed fetching entries");
echo "Found " . count($entries) . " files.
";
if (empty($entries))
die("No valid entries found.");
$stream = reset($entries)->getStream();
if ($stream === FALSE)
die("Failed opening first file");
$rar_arch->close();
echo "Content of first one follows:
";
echo stream_get_contents($stream);
fclose($stream);
?>
The above example will output something similar to:
Found 2 files.
Content of first one follows:
Encrypted file 1 contents.
Example #2
Procedural style
<?php
$rar_arch = rar_open('encrypted_headers.rar', 'samplepassword');
if ($rar_arch === FALSE)
die("Failed opening file");
$entries = rar_list($rar_arch);
if ($entries === FALSE)
die("Failed fetching entries");
echo "Found " . count($entries) . " files.
";
if (empty($entries))
die("No valid entries found.");
$stream = reset($entries)->getStream();
if ($stream === FALSE)
die("Failed opening first file");
rar_close($rar_arch);
echo "Content of first one follows:
";
echo stream_get_contents($stream);
fclose($stream);
?>
Example #3
Volume Callback
<?php
/* In this example, there's a volume named multi_broken.part1.rar
* whose next volume is named multi.part2.rar */
function resolve($vol) {
if (preg_match('/_broken/', $vol))
return str_replace('_broken', '', $vol);
else
return null;
}
$rar_file1 = rar_open(dirname(__FILE__).'/multi_broken.part1.rar', null, 'resolve');
$entry = $rar_file1->getEntry('file2.txt');
$entry->extract(null, dirname(__FILE__) . "/temp_file2.txt");
?>
SEE ALSO
rar:// wrapper.
PHP Documentation Group RAR_OPEN(3)