07-13-2007
Search for a File Name in a folder
Hello All,
Can you please help me with this request.
I have to identify a file (having file name with perticular pattern)
with in a range.
Example:
input file name can be:
myfile2007_03
myfile2007_45
myfile2007_198
myfile2007_25
myfile2007_101
my program has to identify filename which has the suffix with in the range of 1 to 99.
it should trigger only files:
myfile2007_03
myfile2007_45
myfile2007_25
********************
Thanks in advence for your help.
S
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Oracle procedure create files on UNIX folder on a regular basis. I need to FTP files onto windows server and place the files, based on their name, in the corresponding folders. File name is as follows: ccyymmddfoldernamefile.txt; Folder Name length could be of any size; however, the prefix and... (3 Replies)
Discussion started by: MeganP
3 Replies
2. UNIX for Dummies Questions & Answers
I have a directory /dir1/dir2/dir3/dir4/dir5.
How can I search for files only in dir4/ and not in dir5? I tried the maxdepth command, but it doesn't work in this flavor of sun OS.
When I search for files in dir4, it's giving me results from dir5 as well. I don't want this.
Thanks. (3 Replies)
Discussion started by: bbbngowc
3 Replies
3. Shell Programming and Scripting
This is the file structure:
DESKTOP/Root of Photo Folders/Folder1qweqwasdfsd/*jpg
DESKTOP/Root of Photo Folders/Folder2asdasdasd/*jpg
DESKTOP/Root of Photo Folders/Folder3asdadfhgasdf/*jpg
DESKTOP/Root of Photo Folders/Folder4qwetwdfsdfg/*jpg
DESKTOP/Root of Photo... (4 Replies)
Discussion started by: guptaxpn
4 Replies
4. Shell Programming and Scripting
Hello guys
I am sure that you will help me on this issue as you did earlier::)
Scenario :
I have a folder named "XYZ". It consist many sub-folders and subfolder contain severals files. there may be abc.dat in each subfolder. Now i want to seperate subfolders on follwing conditions-
if abc.dat... (12 Replies)
Discussion started by: infiant
12 Replies
5. Shell Programming and Scripting
I want to select only second line.
I want to search for any line that has both ->
input.txt
/userA/aaaaaaabbb/jakarta
/userA/aaaaaaa/jakarta
/userB/aaaaaaabbb/jakarta
/userB/aaaaaaa/jakarta
This command does have effect of -->
$>cat input.txt | /usr/xpg4/bin/grep -E... (13 Replies)
Discussion started by: kchinnam
13 Replies
6. Shell Programming and Scripting
hi ..
i have a problem how to search file with date and version number(ms_2.0_dd/mm/yy_24)in folder.Here 24 is version number and compare the this file to other file which is in another folder and if does not match then copy this file to respective folder.Also copy different files in different... (1 Reply)
Discussion started by: shubhig15
1 Replies
7. Shell Programming and Scripting
How can this be done?
I mean, I want to search for all *png *jpg *bmp files in my ~/Pictures/ folder....How can I list them?
Thank you geeks :) :b: (2 Replies)
Discussion started by: hakermania
2 Replies
8. Shell Programming and Scripting
Have to read one file say sourcefile containing several words and having another folder containing several files.
Now read the first word of Sourcefile & search it into the folder consisting sevral files, and create another file with result. We hhave to pick the filename of the file in which... (3 Replies)
Discussion started by: mukesh.baranwal
3 Replies
9. Shell Programming and Scripting
I'm trying to find folders created by a propritary data aquisition software with the .aps ending--yes, I have never encountered folder with a suffix before (some files also end in .aps) and sort them by date. I need the whole path
ls -dt "$dataDir"*".aps"does exactly what I want except for the... (2 Replies)
Discussion started by: Michael Stora
2 Replies
10. Shell Programming and Scripting
here is the path on Macintosh:
Macintosh HD/Users/shawn/Desktop/ATP/ATP14 bon bon/ATP14 bon bon.jpg
I need to find the folder with ATP14 in the name, then open the folder
I need to find the file whose name starts with ATP14 in the folder in 1 above
I had been using this in Applescript... (1 Reply)
Discussion started by: sbrady
1 Replies
MHPATH(1) [nmh-1.5] MHPATH(1)
NAME
mhpath - print full pathnames of nmh messages and folders
SYNOPSIS
mhpath [+folder] [msgs] [-version] [-help]
DESCRIPTION
mhpath expands and sorts the message list `msgs' and writes the full pathnames of the messages to the standard output separated by new-
lines. If no `msgs' are specified, mhpath outputs the current mail folder's pathname instead. If the only argument is `+', your nmh
"Path" is output; this can be useful in shell scripts.
Contrasted with other nmh commands, a message argument to mhpath may often be intended for writing. Because of this:
1) the name "new" has been added to mhpath's list of reserved message names (the others are "first", "last", "prev", "next", "cur", and
"all"). The new message is equivalent to the message after the last message in a folder (and equivalent to 1 in a folder without mes-
sages). The "new" message may not be used as part of a message range.
2) Within a message list, the following designations may refer to messages that do not exist: a single numeric message name, the single
message name "cur", and (obviously) the single message name "new". All other message designations must refer to at least one existing
message, if the folder contains messages.
3) An empty folder is not in itself an error.
A message number less than that of the smallest existing message in a folder is treated as if the message already exists. A message number
greater than that of the highest existing message in a folder causes an "out of range" error message to be displayed.
As part of a range designation that contains messages that do exist, message numbers less than the smallest, or greater than the highest,
existing message in a folder are ignored.
Examples: The current folder foo contains messages 3 5 6. Cur is 4.
% mhpath
/r/phyl/Mail/foo
% mhpath all
/r/phyl/Mail/foo/3
/r/phyl/Mail/foo/5
/r/phyl/Mail/foo/6
% mhpath 2001
mhpath: message 2001 out of range 1-6
% mhpath 1-2001
/r/phyl/Mail/foo/3
/r/phyl/Mail/foo/5
/r/phyl/Mail/foo/6
% mhpath new
/r/phyl/Mail/foo/7
% mhpath last new
/r/phyl/Mail/foo/6
/r/phyl/Mail/foo/7
% mhpath last-new
mhpath: bad message list last-new
% mhpath cur
/r/phyl/Mail/foo/4
% mhpath 1-2
mhpath: no messages in range 1-2
% mhpath first:2
/r/phyl/Mail/foo/3
/r/phyl/Mail/foo/5
% mhpath 1 2
/r/phyl/Mail/foo/1
/r/phyl/Mail/foo/2
mhpath is also useful in back-quoted operations:
% cd `mhpath +inbox`
% echo `mhpath +`
/r/phyl/Mail
FILES
$HOME/.mh_profile The user profile
PROFILE COMPONENTS
Path: To determine the user's nmh directory
Current-Folder: To find the default current folder
SEE ALSO
folder(1)
DEFAULTS
`+folder' defaults to the current folder
`msgs' defaults to none
CONTEXT
None
BUGS
Like all nmh commands, mhpath expands and sorts [msgs]. So don't expect
mv `mhpath 501 500`
to move 501 to 500. Quite the reverse. But
mv `mhpath 501` `mhpath 500`
will do the trick.
Out of range message 0 is treated far more severely than large out of range message numbers.
MH.6.8 11 June 2012 MHPATH(1)