Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
searching workarea if a file exists.
sspopuri
I want to search for a file (usual with a path with in a workware) if it exists.
Is there a way to do this? The file could be anything like image, pdf, text etc.
Any help would he appreciated.
Thanks in advance,
shyam.
Find more posts tagged with
Comments
jbonifaci
If you have the full path to the file and want to check if it exists in perl, you can use the -e <path> test. If you want to find a file in any subdirectory within a given base directory, you can do this in perl with opendir. This will give you back the list of files and directories in the root directory. If you don't find the file here, recursively open each of the sub-directories until you either find the file or have searched all directories.
JonathonG
File::Find is a real hand perl module for doing this. It takes care of all the opendir/readdir/recurse stuff for you
Jonathon
Independent Interwoven Contractor