Not sure I understand your problem. Are respective file and folder named identically (except for the .csv extension)? Use ls | tail -2 or ls | sort -r | head -2 .
If they are always different, why are the all the same in your example??? Why do you even have directories if all of your directories and *.csv files are all in a single directory?
Is "the location" on your system? Or, is it on a remote system?
20140630-144422 is a directory named after 30th June 2014 with a time at the end. Subsequently we have a input feed file as "20140630-144422.csv" for the same date.
Similarly 20140707-182653 is a directory named after 7th July 2014 with a time at the end. Subsequently we have a input feed file as "20140707-182653.csv" for the same date.
File and folder names are different because each one is identified by date and time. Each ".csv" file is accompanied with a directory with a same name.
Directory contains all images and the CSV file contains data which needs to be associated with the images. The provider puts data and the images daily.
Only the file with current date (time need not be checked) has to be pulled from the FTP location for processing.
I want to download the images from the latest directory and save it in the server under one path for example /websites/www.abc.com/images. And CSV has to be downloaded under another
path like "/root/dataprocess/abc".