- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Directory Exist or not
Operating System - Linux
1820710
Members
2922
Online
109627
Solutions
Forums
Categories
Company
Local Language
юдл
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Discussions
Forums
Forums
Discussions
юдл
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-11-2005 11:38 PM
тАО10-11-2005 11:38 PM
Directory Exist or not
how to check if directory exist or not
for eg: /home/example/test/
i want to check test directory exist in /home/example/ if not eror wil be come
for eg: /home/example/test/
i want to check test directory exist in /home/example/ if not eror wil be come
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-11-2005 11:41 PM
тАО10-11-2005 11:41 PM
Re: Directory Exist or not
Why don't you use
# ls -ld /home/example/test/
/home/example/test/ not found
-Arun
# ls -ld /home/example/test/
/home/example/test/ not found
-Arun
"A ship in the harbor is safe, but that is not what ships are built for"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-11-2005 11:46 PM
тАО10-11-2005 11:46 PM
Re: Directory Exist or not
if [ `ls -ld /dirname | wc -l` -ne 1 ]
then
echo "/dirname does not exist"
fi
Pete
Pete
then
echo "/dirname does not exist"
fi
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-11-2005 11:51 PM
тАО10-11-2005 11:51 PM
Re: Directory Exist or not
Hi:
# [ -d /home/example ] && echo "Directory exists" || echo "No Directory"
See the manpages for 'test'.
Regards!
...JRF...
# [ -d /home/example ] && echo "Directory exists" || echo "No Directory"
See the manpages for 'test'.
Regards!
...JRF...
- Tags:
- Test
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Learn About
News and Events
Support
© Copyright 2025 Hewlett Packard Enterprise Development LP