02-04-2009
Quote:
Originally Posted by
ce9888
if ( -e *.c ) then
echo "Found .c files"
else
echo ".c files not found"
endif
Thanks for ur kind reply friend...I tried now but it is giving error that confusion(ambuious)in *.c........
plz give me if anyother ways plzzzzzzzzzzzzzzzzzzzz
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
I want to sftp some files to a remote directory. Before transferring files i want to check whether the required folder exists. If so copy the files to that folder, else create the folder and copy the files.
Thanks in adv (1 Reply)
Discussion started by: borncrazy
1 Replies
2. Shell Programming and Scripting
Hi, I have cobbled together a simple script to create a Windows folder in a bunch of home folders on a mac server using the following code.
for i in /Volumes/student_data/studenthomefolders/*
do
u=`echo $i | cut -d/ -f5`
//if
//then
//echo "Folder already exists for "$u" Skipping"
//else... (4 Replies)
Discussion started by: psyman
4 Replies
3. Shell Programming and Scripting
hi,
I posted a thread before on that subject, but with a wrong focus...
here's my problem: I want to check if a file exists in a windows shared folder mounted using:
sudo mount -t cifs -o username=xxx,password=xxx,uid=xxx,gid=xxx //192.168.0.92/public /media/92_shared
I tried
if
... (2 Replies)
Discussion started by: jul
2 Replies
4. Shell Programming and Scripting
Hi All,
working on AIX 5.3.
Requirement is:
Shell script in ksh to check if any file exists in 4 folders as below:
1. /FILE/INB/INT1
2. /FILE/INB/INT2
3. /FILE/INB/INT3
4. /FILE/INB/INT4
Thanks a lot for your time!
a1_win. (3 Replies)
Discussion started by: a1_win
3 Replies
5. Shell Programming and Scripting
Hello!
I'm stuck with a problem that i can't solve. I'm very new to unix, linux and shell scripting i might add. I'm trying to create a script that will execute as follows:
First start the script - sh exist
Then the prompt asks the user to input a username to check if it exists within the... (6 Replies)
Discussion started by: bib2006
6 Replies
6. UNIX for Dummies Questions & Answers
Hi,
Below is some code that I would like to implement however I am getting these errors: (what I am attempting to do is to check if a zip file has ascii files and if ascii and not binary then move the ascii files to a folder. some of the files are in xml format but are ascii and i will be moving... (0 Replies)
Discussion started by: bwcberb
0 Replies
7. Shell Programming and Scripting
Hi,
When trying to chk if a folder exists on remote server using the below command (got it from other thread in this forum)
"ifvchr@s1.mrix.local '/cygdrive/d/shares/projects\ data\ load/test\ files/$SCPED_FILES$name$code'`];
then
echo "Directory exists";
else
echo "Directory... (0 Replies)
Discussion started by: funonnet
0 Replies
8. Shell Programming and Scripting
Hi,
It will be great help if any of them can provide or tell which scripting is possible to write for checking folder exists or not in Windows server from Unix/Windows machine.
If folder doesn't exist then need to create the folder through script and copy the files.
It is on very... (1 Reply)
Discussion started by: prakashchakra7
1 Replies
9. Shell Programming and Scripting
Hi All,
I am a beginner in this and trying to write a shell script in linux which will :
1. Ask for a file name and check if its exists.
2. If file exists only then it will ask for the new target folder, after entering target folder name it will check if it exists.
3. If target folder... (3 Replies)
Discussion started by: ashish_neekhra
3 Replies
10. Shell Programming and Scripting
Hi Team,
I am new to shell script and there is a requirement where files should be moved from Subfolder to parent folder.
Eg:
parent folder --> /Interface/data/test/IN
Sub folder -->/Interface/data/test/IN/Invoice20180607233338
Subfolder will be always with timestamp... (6 Replies)
Discussion started by: srivarun15
6 Replies
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)