Date format of remote system

Hi,

I am trying to write a small code where i capture the output of ls command on a remote system.
However i want a certain consistency in the date format being received
Say i want it to be dd/mm/yyyy format.

how can i do this?

This is what i am doing currently

FTP1=`ssh ${USER_FTP_origin}@${MACHINE_FTP_origin} 2> /dev/null << ! 
    cd ${PATH_ORIGIN}
    ls -1 $File_name
    exit
!`

This however sometimes gives me the date in dd/mm/yyyy and sometimes in mm/dd/yyyy format.
Please suggest what can be done

Thanks

Which date? ls -1 just gives the names, one per row. Whichever date you mean, it could be because the remote machines are different?
:confused:

Else there is always the possibility to use date format options.

man date

Hi,

I understood my mistake.Thanks for the reply anyways.
I will try to be a little more careful in posting my queries next time.

Cheers

On GNU-Linux (coreutils 6.10).

For ls command:

 ls  -l --time-style=+'%d/%m/%Y'

If it is a time stamp that you need, insert this in your script:

date +'%d/%m/%Y'

You can (partially) influence the output format of ls by setting the LANG environment variable to a certain locale, eg:

$ touch -t 200801010000.00 test.file
$ LANG=C ls -l test.file
-rw-r--r-- 1 pludi users 0 Jan  1  2008 test.file
$ LANG=en_GB ls -l test.file
-rw-r--r-- 1 pludi users 0 2008-01-01 00:00 test.file
$ LANG=en_US ls -l test.file
-rw-r--r-- 1 pludi users 0 2008-01-01 00:00 test.file
$ LANG=de_AT ls -l test.file
-rw-r--r-- 1 pludi users 0  1. J�n 2008  test.file

Please can you post one example of each of the different "ls" formats you have seen, stating which Operating System was involved in each and every case. Please create the examples on the same day when dd != mm.

Translating timestamps from "ls -la" to numeric date format has been covered extensively on this site. If there is a small variety of formats to deal with why not create a flag file on each computer which you can read in your script.

If you are the administrator of these machines you could use "C" programming language to get stat (man 2 stat) information in a consistent format across a wide variety of platfoms.