I have a directory on a server. I need to find the list of sub directories and find the latest one.
How do I accomplish this using shell script ?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you have local access then
ls -adt */. | head -n 1should work.If you don’t have local access, the best way to get something like
wget <url>/?C=M;O=D -q -O -and parse the results – if the Web server is Apache andIndexesdirective is on for the directory.