Sponsored Content
Top Forums Shell Programming and Scripting WildCard serach for files in a directory Post 302368210 by frans on Wednesday 4th of November 2009 10:16:38 AM
Old 11-04-2009
Code:
function TestFiles ()
{   for I in testapp newfile obsolete
     do   ls file$I_* || return 1
     done
}

I don't know if you want to examine multiple directories.
You can use this simle statement in a terminal and look if it works
Code:
for I in testapp newfile obsolete; do ls file$I_* || echo "not found" > test.txt; done

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Find wildcard .shtml files in wildcard directories and removing them- How's it done?

I'm trying to figure out how to build a small shell script that will find old .shtml files in every /tgp/ directory on the server and delete them if they are older than 10 days... The structure of the paths are like this: /home/domains/www.domain2.com/tgp/ /home/domains/www.domain3.com/tgp/... (1 Reply)
Discussion started by: Neko
1 Replies

2. Shell Programming and Scripting

move files using wildcard

I have the following requirement. PATHA =/opr/itr/ PATHB=/etc/data/ FILENAME=*abc* file name is wild carded as there could be many files with name abc anywhere I tried mv $PATHA/$FILENAME $PATHB and I got a error that /etc/data/ can not be created Could any one please help. ... (1 Reply)
Discussion started by: onlyjayaram
1 Replies

3. Shell Programming and Scripting

Fastest way to list a file in a folder containing 800,000 files using wildcard

Hi, I have a directory with possibly around 800,000 files in it. What is the fastest way to list file(s) in this directory with a wildcard. for example would ls -1 *.abcdefg.Z or find . -name "*.abcdefg.Z" be the fastest way to find all of the files that end with .abcdefg.Z... (6 Replies)
Discussion started by: jerardfjay
6 Replies

4. UNIX for Dummies Questions & Answers

Concatenation of multiple files with wildcard

I have the following snippet to concatenate about a hundred csv-files: for file in *csv; do cat $file >> newfile; done This line works, but before I was experimenting with the following line, which is more intuitive and is a tad more robust: for file in *.csv; do cat $file >> newfile; done Can... (2 Replies)
Discussion started by: figaro
2 Replies

5. UNIX for Dummies Questions & Answers

Serach a pattern

Hi, I am trying to find a particular patter in multiple UNIX files (also contain system files,hidden files and normal files) i am now using CMD: egrep -ali 'pattern' * i am not getting the required result, i just need files path and finename Naveen (3 Replies)
Discussion started by: Naveen_5960
3 Replies

6. Shell Programming and Scripting

Change directory with wildcard in FTP server

Hi , I am looking for a command to change directory in FTP server with wildcard specified. Basically this is what i am trying. localserver# ftp remoteserver ftp> ls 41000_42000 42000_43000 ftp> cd 41* 550 CWD failed. '41*' : no such file or directory. Could anyone please let me know... (6 Replies)
Discussion started by: thavamaniraja
6 Replies

7. Shell Programming and Scripting

find command with wildcard directory

I want to look if there is any file inside a specific directory which was modified before 2 days. I wrote the find command, but the problem is there is one directory and that is a random directory generated by unix, so not sure on how to code for that on the find command. find... (5 Replies)
Discussion started by: srini0603
5 Replies

8. Shell Programming and Scripting

ksh(!93) for loop with wildcard and empty directory

I'm sure this is by design, but using something like for f in dir/* do echo $f done produces unexpected (to me) results if run against an empty directory. I'd have expected it to not execute the loop, but it actually calls it with f set to 'dir/*'. Now I know that I'm trying to protect... (2 Replies)
Discussion started by: spr00t
2 Replies

9. Shell Programming and Scripting

Directory containing files,Print names of the files in the directory that are exactly same content.

Given a directory containing say a few thousand files, please output a list of all the names of the files in the directory that are exactly the same, i.e. have the same contents. func(a_directory_name) output -> {“matches”: , ... ]} e.g. func(“/home/my/files”) where the directory... (7 Replies)
Discussion started by: anuragpgtgerman
7 Replies

10. Shell Programming and Scripting

How to list and move files with spaces and wildcard?

I am writing a code that can move and archve all the files in a directory except the latest file based on file pattern provided in a controlfile. The filename is in the form of pattern. So basically we find the all the files of the pattern provided and archive all of them, leaving one latest file.... (3 Replies)
Discussion started by: Saanvi1
3 Replies
MACSTREAM(L)															      MACSTREAM(L)

NAME
macstream - Convert a series of files to a MacBinary stream SYNOPSIS
macstream [ - options ] files DESCRIPTION
macstream takes the files specified in files and combines them to a MacBinary stream on standard output subject to the options specified. If files also specifies directories they are followed recursively, and all files found will be put in the MacBinary stream, together with directory information. OPTIONS
In the absence of any options, macstream takes the specified files and silently combines them to a MacBinary stream, writing the result to standard output. Directories named in files are followed recursively, all files found will be put in the MacBinary stream, together with directory information. Files are assumed to be in MacBinary format. However, if the filename ends with .info the file is assumed to be the info fork of a MacIntosh file split amongst more than one file. In that case the files with .data and .rsrc extension are also read (if present). Also, if the info fork is mentioned in the parameter list, the names of data and resource forks can also be mentioned, but those will be ignored (this is to allow wild-card expansion by the shell.) Further, if some form of AppleShare is supported by the installed program, and if the current directory, or one of the directories found during recursive processing, is a directory in the format of the supported version of AppleShare, those files will be handled according to the properties of AppleShare. -r No intelligent file-processing is performed; all files named are assumed to be plain resource files, and are written as MacIntosh resource files with creator "RSED" and type "RSRC", unless another creator and/or type are specified. -d No intelligent file-processing is performed; all files named are assumed to be plain data files, and are written as MacIntosh data files with creator "MACA" and type "TEXT", unless another creator and/or type are specified. -u As -d, but the codes for CR and LF are interchanged. -U Is a synonym for -u. -c creator Defines the creator name to be used if one of the previous options is specified. -t type Defines the type name to be used if one of the previous options is specified. -l List every file and directory processed. -i Do not output files, give information only (implies -l.) -q Ask the user for every file/directory whether it should be visited (implies -l.) -V Gives the patchlevel of the program, and other information. Other options are ignored and the program quits immediately. -H Give short information about the options. Other options are ignored and the program quits immediately. BUGS
As this is a beta release, there may still be some problems. SEE ALSO
macutil(1) AUTHOR
Dik T. Winter, CWI, Amsterdam, The Netherlands (dik@cwi.nl) 3rd Berkeley Distribution October 22, 1992 MACSTREAM(L)
All times are GMT -4. The time now is 12:18 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy