Hi,
I want to concatenate the filename with the current date using the get command in ftp.
for ex:
<filename><date>
emp101_20080526
Can you please let me know the command for this.
thanks,
Aswarth.
Hi,
I want to concatenate the filename with the current date using the get command in ftp.
for ex:
<filename><date>
emp101_20080526
Can you please let me know the command for this.
thanks,
Aswarth.
Have you tried to simply assign the variables and then use
$FILENAME$DATE
try this:
fileName=emp101_`date +%Y%m%d`
get $fileName
hi,
can you please let me know if there is any command in ftp to pick the latest file in a folder.
for ex the filename is concatenated with date and timestamp like this.
emp001_20080516053646.dat
emp001_20080517053646.dat
emp001_20080518053646.dat
where in the format of date is yyyymmddhhmmss
thanks,
Aswarth
Pick up the latest file in a variable, using the following command:
latest_file=`ll -ltr | tail -1`
Use the variable latest_file in your ftp.
Thanks!
nua7
but that folder contains other files apart from the files that I have mentioned.
so how can include the file name in the comand that you have given me like emp_oo1
thanks,
aswarth
u can make use of the find command with the using the following flags
n is the no of minutes ago...
for instance
$ find -name <file name> -ctime 2
this should work just fine
I am logging into a remote server using ftp mode.
In a folder there are set of files like this
emp001_20080526052714.dat
emp001_20080526052715.dat
emp001_20080526052716.dat
dept001_20080526052714.dat
dept001_20080526052715.dat
dept001_20080526052716.dat
I need to pick the latest file starting with emp001_
Can you please let me know the ftp command to pick the latest file and assign it to a variable so that i can use that variable to the 'get' command in ftp.
Thanks,
Aswarth.
In that case try using sftp.
nua7@berlin:~$ sftp host2
Connecting to host2...
nua7@host2's password:
sftp> ll -ltr | tail -1
-rwxr-xr-x 1 nua7 dep 40848 Jun 27 09:01 filea
sftp> get filea
Fetching /home/nua7/filea to filea
sftp> put fileb
Uploading fileb to /home/nua7/fileb
sftp> rm filea
Removing /home/beat/filea
sftp> quit
nua7@berlin:~$
In my case sftp is not working as i dont have the permissions.
can u pls let me know if there is any command to get the name of the latest file from a folder if i am in ftp mode.
thanks