Sponsored Content
Full Discussion: find file name...in SFTP
Top Forums Shell Programming and Scripting find file name...in SFTP Post 302224860 by Shahul on Thursday 14th of August 2008 05:35:28 AM
Old 08-14-2008
Thanks for you valid suggestion.... Smilie

let me try to do that through ssh..


i have one more question if you could answer!

using below command i get some filename in my unix ...

in some location ... /home/testfolder/

ls -lrt | grep -l $value *.csv > temp1.txt

i would get some out put like below
test.csv
test2.csv
test3.csv

now i want to know which one is the latest one which got generated and i need the timestamp only..is there any way that i can get...

using awk hope i may get.. like this..

ls -lrt test3.csv | awk '{print $6,$7}'

output i am getting like ...

jan 18

because using this time stamp i need to check some other files in different location as well...


Thanks
Sha
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

SFTP +Find

Hi, I am using sftp to loging to a remote server, I need to remove all the files on the remote which are older than n days and of type *.txt*. I tried "find . -type f -name "*" -mtime +15" > /tmp/temp.$$ but find command does nt work on the sftp. can u pls help me out Thanks ... (6 Replies)
Discussion started by: vikramsnest
6 Replies

2. UNIX for Advanced & Expert Users

Copy a file with sftp

Hi, I should copy a file from my computer in folder on a server. I use sftp account@computername and insert the password. then I write sftp> put /home/path/file to copy the file in my accont folder but this command doesn't work and it says that it couldn't find the file. Hope I was... (5 Replies)
Discussion started by: jborges
5 Replies

3. Shell Programming and Scripting

SFTP-how to log individual sftp command error while executing shell script

Hi, I have situation where i need to automate transferring 10000+ files using sftp. while read line do if ; then echo "-mput /home/student/Desktop/folder/$line/* /cygdrive/e/folder/$line/">>sftpCommand.txt fi done< files.txt sftp -b sftpCommand.txt stu@192.168.2.1 The above... (1 Reply)
Discussion started by: noobrobot
1 Replies

4. Shell Programming and Scripting

wanted to find both link file and ordinary file using single find command

find . -type fl o/p is only the ordinary file. where in it wont give the link files. (2 Replies)
Discussion started by: nikhil jain
2 Replies

5. Red Hat

Chroot sftp users, remote sftp login shows wrong timestamp on files

Hello, I have a weird issue, I have RHEL 5.7 running with openssh5.2 where sftpgroup OS group is chroot. I see the difference difference in timestamp on files, when I login via ssh and SFTP, I see four hour difference, is something missing in my configuration. #pwd... (8 Replies)
Discussion started by: bobby320
8 Replies

6. UNIX for Dummies Questions & Answers

Find the latest file on remote sftp

Hi All, I need your help in finding the latest files in remote sftp and get those files to local server and process them. Please let me know I appreciate your valuable inputs. Thanks raj (7 Replies)
Discussion started by: rajeevm
7 Replies

7. HP-UX

To find where sftp public key is installed for user

Hi All, I am facing an issue wherein a new sft public key for a user is not working on our HP-UX m/c. So i have to check where the sftp public keys for some other sample users were installed earlier in the system i.e. under which folder. Can you please help me out on this. (2 Replies)
Discussion started by: ammbhhar
2 Replies

8. Shell Programming and Scripting

Sftp : not able to print the echo statements after the sftp transfer

I had the below sftp script working perfectly but the problem is I am not able to send the echo statements . #!/bin/sh echo "Starting to sftp..." sftp admin@myip << END_SCRIPT cd /remotepath/ lcd /localpath/ mget myfiles*.csv bye END_SCRIPT echo "Sftp successfully." echo echo... (11 Replies)
Discussion started by: scriptscript
11 Replies

9. Shell Programming and Scripting

How to overwrite a file by transferring the file using sftp?

hi, i am using sftp to transfer files between two servers, if i connect to a remote server using sftp n moves a file say "S123.txt" to the remote server, it moves successfully, but when i try to execute the same sftp script to move the same files to the same remote server, the old file is... (3 Replies)
Discussion started by: Little
3 Replies

10. Shell Programming and Scripting

How to find whether a particular command has failed inside an sftp script?

hi, how can i know whether a command inside an sftp script has failed or not? i have a sftp expect script #!/usr/bin/expect spawn /usr/bin/sftp abc@ftp.abc.com expect "sftp>" send "cd dir\r" expect "sftp>" send "mput abc.txt\r" expect "sftp>" send "mput def.xls\r" expect "sftp>"... (5 Replies)
Discussion started by: Little
5 Replies
SSH2_SFTP_STAT(3)							 1							 SSH2_SFTP_STAT(3)

ssh2_sftp_stat - Stat a file on a remote filesystem

SYNOPSIS
array ssh2_sftp_stat (resource $sftp, string $path) DESCRIPTION
Stats a file on the remote filesystem following any symbolic links. This function is similar to using the stat(3) function with the ssh2.sftp:// wrapper in PHP 5 and returns the same values. PARAMETERS
o $sftp - An SSH2 SFTP resource opened by ssh2_sftp(3). o $path - RETURN VALUES
See the documentation for stat(3) for details on the values which may be returned. EXAMPLES
Example #1 Stating a file via SFTP <?php $connection = ssh2_connect('shell.example.com', 22); ssh2_auth_password($connection, 'username', 'password'); $sftp = ssh2_sftp($connection); $statinfo = ssh2_sftp_stat($sftp, '/path/to/file'); $filesize = $statinfo['size']; $group = $statinfo['gid']; $owner = $statinfo['uid']; $atime = $statinfo['atime']; $mtime = $statinfo['mtime']; $mode = $statinfo['mode']; ?> SEE ALSO
ssh2_sftp_lstat(3), lstat(3), stat(3). PHP Documentation Group SSH2_SFTP_STAT(3)
All times are GMT -4. The time now is 04:15 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy