Page 1 of 2

How the find a File in the Directory in DOS

Posted: Thu Aug 18, 2005 2:52 pm
by reddy
Sir,

I have a situation like this:

I have a sequencer with lot of jobs,Before running one of cleanup job i have tp look for particular file in directory.Please put light on me.

It's windows OS.

Thanks for help.

Narasa

Posted: Thu Aug 18, 2005 2:57 pm
by kommven
wait for file activity is perfect for you.
I presume wildcard doesn't work here. You should have a specific file name.

Clarification do you have server on the machine where the file arrives?

Posted: Thu Aug 18, 2005 3:03 pm
by reddy
Sir,

Sorry for confusing you.My question is how can i look for a particular file in a directory before running another job based on i will decide which i have to run.
I think i have to before subroutine using DOS Batch file.
But i don't know the scriprt.
Please light on me.

Thanks
Narasa

Posted: Thu Aug 18, 2005 4:39 pm
by kduke
I a routine you can open the directory like a hash file.

Code: Select all

Ans = @FALSE
DirName = Arg1
FileName = Arg2
openpath DirName to MyDir then
   read Rec from MyDir, FileName then
      Ans = @TRUE
   end
end

Posted: Thu Aug 18, 2005 5:58 pm
by reddy
Sir,

I have to look for 40 files if any of them exists i have to run job a other wise job b. how can i write routine for it please halp me.

Thanks
Narasa

Posted: Thu Aug 18, 2005 6:57 pm
by kduke
I gave you a routine to find one file. You should be able to find the next 39. We are not here to do your job. Just point you in the right direction.

Posted: Fri Aug 19, 2005 7:03 am
by reddy
Hello Sir,

I will give clear explanation here.

I have path of files like this \\data\USA\Processed.txt or
\\data\IND\Processed.txt
\\data\RUS\Processed.txt
\\data\CAN\Processed.txt
\\data\BRT\Processed.txt
.............................
Like this for 40 countries.If any on of the file exits i have to abort the job
before the jobX.
Is there any DOS command to find the file path like this

\\data\*\Processed.txt.

Please help me on this.

Thanks
Narasa

Posted: Fri Aug 19, 2005 7:24 am
by ArndW
Take a good look at the "dir /s Processed.txt" command in dos, this will give you a list of the files found. You can write a Function that calls this command and gets the result in a string.

Posted: Fri Aug 19, 2005 8:26 am
by reddy
Thanks a lot sir.

Posted: Fri Aug 19, 2005 5:04 pm
by ray.wurlod
There is a little-known utility that ships in the DataStage bin folder. The utility is called uvwalk and can perform a treewalk in a directory structure, much like find does in UNIX.

This might provide a more flexible solution.

Get to a DOS prompt and execute uvwalk with no command line arguments; it will issue a "this is the correct syntax" message showing you the options.

Posted: Fri Aug 19, 2005 11:48 pm
by kumar_s
uvwalkbefore tthat, we need to set the path for executing the command right? :roll:
coz its not working for me, (parallel EX)

reagrds
kumar

Posted: Sat Aug 20, 2005 1:33 am
by ray.wurlod
Why should uvwalk be different from any other operating system command? :roll:

Posted: Sat Aug 20, 2005 7:23 am
by chulett
If you expect some help, you might want to explain what 'not working for me' means. :roll:

What you've tried, what error message you've gotten, that sort of stuff.

(I wonder, how many posts in a row can we get with rolly eyes in it?)

Posted: Sun Aug 21, 2005 4:43 am
by kumar_s
I could not find uvwalk in the bin directory,if searched in

Code: Select all

/ds/Ascential/DataStage/DSEngine/bin
should i have to find it any where else :roll:
(i cant stop rolling my eys)

regards
kumar

Posted: Sun Aug 21, 2005 6:17 am
by ArndW
Kumar,

I have 7.5.1 on AIX and couldn't find it either, perhaps Ray is referring to a Windows-only executable... especially as UNIX does have a "find".