SFTP +Find


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting SFTP +Find
# 1  
Old 08-10-2007
Question 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
vikramsnest Smilie
# 2  
Old 08-10-2007
SFTP uses the SSH protocol, so use SSH directly to do the find.
# 3  
Old 08-10-2007
Not sure of your OS. But if your platform is Linux, sshfs is a great way to mount a remote filesystem over SSH, then you can simply do whatever you want as with a local filesystem.
# 4  
Old 08-10-2007
thx

Hi ,
Can u please send me some sample code ...
# 5  
Old 08-10-2007
ssh .... user@host find .....
# 6  
Old 08-11-2007
Issue

thx a lot frnd
i am still facing a problem Smilie
when i do
ssh username@serevrer
cd dir
find . -type f -name "*" -mtime +3 -exec rm {} \;

the script hangs

when i try to do tis at command prompt it works fine

can anyone suggest me a solution
# 7  
Old 08-13-2007
How to access variables across various scripts

Hi All,

I have declared a variable in script1 and assign a value for it. In script2 i'll call script1 and then I want the value of variables set in script1.

I have tried with export, but in vain.
How can I achive this?

Below is the two scripts.

--script1
#!/usr/bin/ksh

echo $1
JAVA_HOME=/opt/java1.4

export JAVA_HOME

--script2
#!/usr/bin/ksh

./setValue.sh

echo "Java is present: ${JAVA_HOME}"

In script2 JAVA_HOME is empty, but in script1 JAVA_HOME has value.

Pls. help me in this.

Thanks in advance
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Needed SFTP script from windows to UNIX server and from UNIX to windows server(reverse SFTP)

hi guys, i need a script to sftp the file from windows to unix server ....(before that i have to check whether the file exists in the windows server or not and again i have to reverse sftp the files from unix to windows server..... regards, Vasa Saikumar. (13 Replies)
Discussion started by: hemanthsaikumar
13 Replies

2. Shell Programming and Scripting

How to find a file with a specific pattern for current sysdate & upon find email the details?

I need assistance with following requirement, I am new to Unix. I want to do the following task but stuck with file creation date(sysdate) Following is the requirement I need to create a script that will read the abc/xyz/klm folder and look for *.err files for that day’s date and then send an... (4 Replies)
Discussion started by: PreetArul
4 Replies

3. 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

4. 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

5. 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

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. 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

8. 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

9. Shell Programming and Scripting

find file name...in SFTP

Hi All, i am using sftp script. Here is my problem.. i have one script which should find out the exception file that has been already placed on SFTP. now i wan to check using script whether the file name is present there or not? i tried using find ...not working. only ls -l... (6 Replies)
Discussion started by: Shahul
6 Replies

10. AIX

SFTP Failed---Request for subsystem 'sftp' failed on channel 0

Hi, While I am trying SFTP my machine to another unix machine , it was working fine till 10 min back. But now i am getting the below error "Request for subsystem 'sftp' failed on channel 0" Could you please someone help me to solve or analyise the root cause... Cheers:b:, Mahiban (0 Replies)
Discussion started by: mahiban
0 Replies
Login or Register to Ask a Question