Sponsored Content
Full Discussion: open files
Top Forums Shell Programming and Scripting open files Post 302504903 by mirni on Tuesday 15th of March 2011 05:56:00 PM
Old 03-15-2011
do a check whether its a dir or regular file, before you open it:

Code:
if [ -d $file ] ; then echo "its a dir" ; fi
if [ -f $file ] ; then echo "its a regular file" ; fi

Also, you got single quotes there, which is probably not what you want. You want "backticks", which is the key next to '1'.
 

10 More Discussions You Might Find Interesting

1. Programming

open ASCII files

Anyone knows how to open an ASCII file by using C Thanks :D (2 Replies)
Discussion started by: Wing m. Cheng
2 Replies

2. UNIX for Advanced & Expert Users

too many files open and questions

Hi all, Presently I'm using a 3pp that uses fopen to open files and I encounter this problem of too many files open when it is trying to open a file. My application is done in java which interfaces with this 3pp. When I instantiate this 3pp it loads up some files but it is pops up the error... (7 Replies)
Discussion started by: lmcanth
7 Replies

3. Solaris

How to check no. of files open currently

I'm getting an error "too many files open" # ulimit -a time(seconds) unlimited file(blocks) unlimited data(kbytes) unlimited stack(kbytes) 8192 coredump(blocks) unlimited nofiles(descriptors) 256 memory(kbytes) unlimited # hard limit shows 1024 I would like to know how many files... (1 Reply)
Discussion started by: max_min
1 Replies

4. UNIX for Advanced & Expert Users

Too Many files open

Hi , We are using a Tool which runs on Unix Server. Have a Event which have some join operation and tries to open files depending on the join operation. So get the error config/variants/orcl6/partitions/ml6/data/ap_PCardMap.csv (Too many open files) Can someone please... (3 Replies)
Discussion started by: shashank_recj
3 Replies

5. OS X (Apple)

Open Files for a process

I am having a client/server application which will download files from server. If server has directories, it will create directories/sub directories and then download files. In this process, I observed that number of open files are more than 400 (which is approxmately same as number of dir/subdir... (1 Reply)
Discussion started by: satyam90
1 Replies

6. Programming

Too many open files - C++ on Unix

Hi all, My requirement is like this: I have list of numbers, i need to get the data related to those numbers from database and write the information into a file . I am using open function to write data related to one number. Close the file. Get the next number ,write data and close again. ... (2 Replies)
Discussion started by: parvathi_rd
2 Replies

7. UNIX for Dummies Questions & Answers

How can i open rar files

Is there a way to open rar files on linux i would really appretiate if u would help :) (2 Replies)
Discussion started by: abu_malek
2 Replies

8. Red Hat

How to open RAR files?

May be this is a newbie question but i want to know hoe to open the RAR file in linux? (1 Reply)
Discussion started by: ashok.g
1 Replies

9. Shell Programming and Scripting

Flagging Open Files

A quick breakdown of my situation: I have 2 servers running OS 10.7, one in the US, the other in China. A folder is being synchronized via EMC's "Syncplicity". Here is my problem- When we open an Excel spreadsheet on one server, Syncplicity does not sync over the temporary file that Excel... (0 Replies)
Discussion started by: sudo
0 Replies

10. Red Hat

Process to use open files

I would like to test open files usage in my system, if I want to create a process ( or script ) that can use a certain amount ( eg. 1000 ) of open files , is it possible to create such process ( or script ) ? (3 Replies)
Discussion started by: ust
3 Replies
Dist::Zilla::Plugin::FileFinder::ByName(3pm)		User Contributed Perl Documentation	      Dist::Zilla::Plugin::FileFinder::ByName(3pm)

NAME
Dist::Zilla::Plugin::FileFinder::ByName - FileFinder matching on pathnames VERSION
version 4.300020 SYNOPSIS
In your dist.ini: [FileFinder::ByName / MyFiles] dir = bin ; look in the bin/ directory dir = lib ; and the lib/ directory file = *.pl ; for .pl files match = .pm$ ; and for .pm files skip = ignore ; that don't have "ignore" in the path DESCRIPTION
FileFinder::ByName is a FileFinder that selects files by matching the criteria you specify against the pathname. There are three types of criteria you can use. "dir" limits the search to a particular directory. "match" is a regular expression that must match the pathname. "skip" is a regular expression that must not match the pathname. Each key can be specified multiple times. Multiple occurrences of the same key are ORed together. Different keys are ANDed together. That means that to be selected, a file must be located in one of the "dir"s, must match one of the "match" regexs, and must not match any of the "skip" regexs. Note that "file" and "match" are considered to be the same key. They're just different ways to write a regex that the pathname must match. Omitting a particular key means that criterion will not apply to the search. Omitting all keys will select every file in your dist. Note: If you need to OR different types of criteria, then use more than one instance of FileFinder::ByName. A FileFinderUser should allow you to specify more than one FileFinder to use. ATTRIBUTES
dir The file must be located in one of the specified directories (relative to the root directory of the dist). file The filename must match one of the specified patterns (which are converted to regexs using Text::Glob and combined with any "match" rules). match The pathname must match one of these regular expressions. skip The pathname must not match any of these regular expressions. CREDITS
This plugin was originally contributed by Christopher J. Madsen. AUTHOR
Ricardo SIGNES <rjbs@cpan.org> COPYRIGHT AND LICENSE
This software is copyright (c) 2012 by Ricardo SIGNES. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. perl v5.14.2 2012-06-21 Dist::Zilla::Plugin::FileFinder::ByName(3pm)
All times are GMT -4. The time now is 07:26 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy