Programming :: Perl - Directories Given To Opendir Via Foreach Give "No Such File Or Directory" Error

Feb 19, 2009

I'm writing a perl script to remove a test database and part of that is of course getting rid of all files. So I wrote this to do the job:

Code:

This always results in an "Could not open /u00/app/oracle/product/10.2.0/rdbms/dbs for reading: No such file or directory" (that directory is the one ending with the $spfile_dir variable) message, although that directory exists and the executing user has writing rights on it.

The same behaviour if I create the directory array like this:

Code:

The problem does not occur when one of the directories is the only element in the array though. Of course I could copy and paste that part of the script for the second directory, but I don't like that workaround.

View 1 Replies


ADVERTISEMENT

Programming :: Conditional Foreach Loop In Perl?

Jun 1, 2010

#!/usr/bin/perl -w
use strict;
my @files = `ls -1`;

[code]...

View 2 Replies View Related

Programming :: Perl: How To Do A Foreach For Elements In A Database

Jul 15, 2009

For Perl I need to understand a few things. It's unlikely that anyone will be able to give me direct answers but if they could point outI'm trying to hack down an existing script http://eoylpac.org/source/eoy.pl. What I need to be able to do (in a nut shell):1. Open a database2. Read the values for each uniq id and execute a subroutine for each of those values. (The subroutine already exists in the above file 'do_pdf').

View 5 Replies View Related

Programming :: Perl's Foreach Loop Can't Use An Array Element As The Control Variable?

Jul 22, 2011

I'm reading "OReilly Learning Perl 5th Edition", and there are such words:Code:You can use an array element like $fred[2] in every place? where you could use any other scalavariable like $fred.At the bottom of the page, it explains the ? like this:Code:The most notable exception is that the control variable of a foreach loop, which you?ll see later in this chapter, must be a simple scalar.Since Perl has the save-and-restore mechanism for the control variable, why an array element can't be used as the control variable

View 1 Replies View Related

Programming :: Perl Script To Look At A Directory For A New File?

Oct 23, 2009

I am new to programming but I am a quick study. I have this script working.

#!/usr/bin/perl
@info=stat("/share/") or die "Can't stat share $!";
while (1) {

[code]...

View 2 Replies View Related

Programming :: Convert Multiple File In Directory - Ascii To Hex In Perl ?

Apr 9, 2011

I have found a perl script that can convert single file: ascii to hex.

However I have thousand of file that I want to convert from ascii to hex.

Here is the perl script that convert single ascii file to hex in single line:

Quote:

So I would like to read multiple file from a directory.

Then the file will be have same name file with hex data.

Here is sample of the read and write directory file.

Quote:

View 3 Replies View Related

Programming :: Can Perl Move X Amount Of Directories

Jan 8, 2010

I'm in the midst of making a perl script and I was wondering if it was possible, to say, have a folder with 20 files in it, then move 5 files out of there, into a new one. I would like to to do this until the original folder has no more files in it, but I'm very stuck.

View 3 Replies View Related

Programming :: Write A Perl Script Which Will Give An Interactive Session To A User To Execute Command On The Server

Feb 25, 2011

I am trying to write a perl script which will give an interactive session to a user to execute command on the server. I have written a small script to do this :

Code: !/usr/bin/perl -w
use strict;
use Net::SSH::Perl;
my $host = '192.168.1.1';
my $username = 'user';
my $login_passwd = 'test123';

[Code]...

View 2 Replies View Related

Programming :: Perl Script To Count Files And Directories Is Not Working?

Aug 26, 2010

I am new to perl scripting and wrote a perl script to read the directories and files and count the no of files in each directory and generate a log file. The problem is it is not printing anything to the log file. I am copying the script below.

!/usr/local/bin/perl
$dir= 'c:My ProjectsPerl ScriptsNew Folder' ;
$directory_count = 0;
$file_count=0;

[code].....

View 14 Replies View Related

Programming :: Error: Gtk/gtk.h: No Such File Or Directory

Feb 13, 2011

gcc kk.c : kk.c:1: fatal error: gtk/gtk.h: No such file or directory compilation terminated.

View 1 Replies View Related

Programming :: Get The Directories Of A Directory?

Apr 4, 2011

I need to walk in folder recursively in C. To change the directory, I can use chdir, but how I can get the directories of a directory?

View 3 Replies View Related

CentOS 5 Server :: Unable To Give "Perl Path" To Run Perl CGI Script

Jun 2, 2011

I am unable to run perl-cgi script in my cent os Apache server. I have used locate perl command in terminal window and it gives following result:

[code]....

tell which is the path to perl for example "usr/bin perl"

View 13 Replies View Related

Programming :: Error: Sys/timerfd.h: No Such File Or Directory

Mar 8, 2011

In my project iam using timerfd.h file info. I included it header file, Iam using "arm-none-linux-gnueabi-gcc" compiler. This file exists in "arm-2010q1/arm-none-linux-gnueabi/libc/usr/include/sys". When i try to execute the program iam getting error: sys/timerfd.h: No such file or directory. remaining files able to find from the same location(sys/time.h, sys/ioctl.h,sys/socket.h).

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <signal.h>

[Code].....

View 1 Replies View Related

Programming :: Return The Directories In Subject Dir, But Only The Directory Without Path?

May 21, 2010

Very new to this shell scripting/Linux scripting.

subject_dir=/labs/tricam/MERIT/MERIT_0*
for subject in `ls $subject_dir` ; do
if [ ! -d $subject_dir/$subject/feat/glm2010/doublegz/SRRTA.feat ] ; then

[code]....

View 1 Replies View Related

Debian Programming :: Using Perl To Replace Filename Strings In A Directory

Jun 12, 2013

I have a directory of orchestral music .ogg files from a family member. Each track is from a different artist and the CDDB entry adds a ":" character after the artist name in the track title.

Here is an example of what I am referring to:

Code: Select all13_-_Mozart:_Sonata_in_A_major_KV_331.ogg

I would like to parse file names in any given directory and search for the string Code: Select all: and replace it with Code: Select all_ According to this post on stackoverflow, I can use Perl to accomplish this task. I've tried Code: Select allperl -i.bak -pe 's/:/_/' but since I am still learning Perl I'm probably commiting a PEBKAC error.

How would I go about solving this issue with regular expressions using Perl?

View 3 Replies View Related

Programming :: Change Current Working Directory Through A Perl Script?

May 2, 2010

how can i actually switch to another directory with "chdir" in perl.like the we used to do is bash as:

Code:
$cat abc
cd Desktop/

[code]...

View 1 Replies View Related

Programming :: System() Routine Returns: Access: Unix Error (2) No Such File Or Directory

Oct 23, 2010

I am running shell command through C program using system() routine.

I am executing "opcontrol --status" an executable using the this routine and I get the following error. access: unix error (2) No such file or directory

But when I give the complete path to the executable it runs perfectly.

The executable is installed in "/usr/local/bin/" And the path variable has this path.

View 1 Replies View Related

Programming :: Perl Find File And Then Replace String In File

Jul 28, 2009

I have script that I'm working on that updates a username in all the files that are called blah.inc for my framework. since i host a bunch of these web apps i need to do it to all of them. so I need to figure out how to update these files automagically with out me watching it to call vim every time. heres what I have so far

Code:

This finds the files but now i need to figure out how to do s/bob/fred/g on those files.

View 5 Replies View Related

General :: Create A Backup Directory And 3 Directories Within That And Some Files Within The 3 Directories And Then Back Them Up Ot Restore Them?

Dec 19, 2009

i am in need of linux help. iam at college and i need this back/restore script to pass this final part of an assessment. i require a backup script that will not only backup but also restore files to the relevent directories. e.g. users are instructed to store all wordprocessor files in a directory named wp. so i am needing to create a backup directory and 3 directories within that and some files within the 3 directories and then back them up ot restore them. l know i should/have to do this myself by been trying to get/understand info for the last few days and came up with zero.

View 14 Replies View Related

Ubuntu Multimedia :: Cp All The File Entries In This Playlist From Their Various Original Directories And Into One Target Directory?

Jun 14, 2010

I've got a few large, unsorted folders where I dump mp3s. I manage it all through rhythmbox and I've decided to separate the wheat from the chaff by paring down stuff I don't want and throwing all the desirable stuff into a big (~1,800 file) playlist file saved to my desktop.My question to you is, is there a hack that'll let me cp all the file entries in this playlist from their various original directories and into one target directory? Playlist format is:

Quote:
[playlist]
X-GNOME-Title=Biglist
NumberOfEntries=1823[code].....

View 3 Replies View Related

Ubuntu :: Generate MD5SUM Of Entire Directory Including Sub-directories In Single File?

Apr 23, 2011

As I'm gonna transfer large amount of data folders from one hard drive to another, I wanna make sure that the transfer has not corrupted the data. how could I generate MD5SUMs of entire directory including sub directories, in a single file and later, how could I verify with the data I've just transferred.

View 1 Replies View Related

Programming :: Split A File To Multiple File Using Awk Or Perl?

Feb 27, 2011

I have a single file that contain multi-text something likes this:

Quote:

No. Time Source Destination Protocol Info
185 27712.068199 192.168.18.23 192.168.18.191 SMTP S: 250 2.1.5 Ok
No. Time Source Destination Protocol Info
186 27715.068293 192.168.0.50 192.168.5.2 TCP suncacao-jmxmp > 44693 [ACK] Seq=1 Ack=1 Win=64807 Len=1380

[Code].....

View 14 Replies View Related

Programming :: Die 'error' If (xxx) - Valid Perl?

Mar 2, 2010

I saw a wierd code in perl code recently it went kind of like this: die 'error' if (xxx); Now is that valid perl?

View 5 Replies View Related

General :: Find Command Give Error File Not Found?

May 27, 2011

find /var/spool/mqueue -group abc -exec rm -rf {} ;Using above command , I delete all the files belong to group abc.Now the problem i face is that the this command gives error that some files are missing . And this error occur because after creating list of files, it pass that list to rm -rf but till that time sendmail process queue and some of files disapper from /var/spool/mqueue.

View 5 Replies View Related

Programming :: Libmysqlclient Error "libmysqlclient.so.14: Cannot Open Shared Object File: No Such File Or Directory" On Ubuntu 9.10

Apr 1, 2010

I am currently using Ubuntu 9.10. I am writing a small code in C which test the connectivity with MYSQL. I am getting this error. "libmysqlclient.so.14: cannot open shared object file: No such file or directory" What I understand is that you need MYSQL development package in order to access MYSQL database in C. I installed MYSQL using this command. apt-get install mysql-server mysql-client

View 2 Replies View Related

Programming :: Perl Script Wont Run - No Error

Aug 8, 2010

I've been trying to get the ol' hello world script to run in a browser. From the hours of reading of various pages about this, I cant work out Basically I get nothing at all displayed.

the perl (test.pl):
#!/usr/bin/perl
print "Content-type: text/html
";
print "Hello, world!";

[Code]....

The output: Nothing. no error message either in the browser window or in the servers error log. If I change the path or the file name I get "invalid CGI ref" in the Cpanel error log.

I did get this to work for a brief time, then changed the Perl script and it stopped working. So I went back to hello world and havn't seen it work since. What is going on?

View 1 Replies View Related

Programming :: Perl : Get Maxdate From The File?

Apr 7, 2010

I have a input file like below :

949890;01-4477138;20101208;7003907933;0
1352305;01-32175;20101225;7005373440;0
0771586;03-975357;20091206;7004353176;0

[code]....

View 1 Replies View Related

Programming :: Perl: Parsing A Log File?

Nov 9, 2010

I have a log file (test.log) starting & ending within dash (--) as below. I am looking to write a parser for test.log. This test.log file currently has single value for one Job ID but I wish to parse for repeated N values of different Job ID - Job, User, Queue, Dispatched Date, Dispatched Time, Completed Date, Completed Time, Hosts/Processor, CPU_T and TURNAROUND. I can either output this 10 values in another .log file or dump into cgi.

The selected parameters from test.log for parsing with above 10 attributes are -

--
Job <345010>
User <xyz>
Queue <gaussian>

[code]....

View 3 Replies View Related

Programming :: Writing File In Perl/cgi?

Apr 10, 2010

I'm not able to write to a file using my perl cgi script which is as fallows:

Code:
#!/usr/bin/perl -w
use strict;
print "Content-type: text/html

[Code]....

View 4 Replies View Related

Red Hat / Fedora :: Cannot Install The Glbic-common File Cause It Give Me A Conflicting Error

Mar 11, 2010

I am trying to install gcc in RHEL 5.4

These is the output:

I can not install the glbic-common file cause it give me a conflicting error (the package is already install but it is somehow not recognize by the system)

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved