Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

tcl remote file directory exist

Status
Not open for further replies.

0937504390

Programmer
Mar 10, 2010
2
0
0
UA
I'v made a script for remote file backup
I need to check if directory ($TMPDIR) exists..
How can I check it in script?


My script

#!/usr/bin/expect -f
set timeout 100
set PASS ""
set USER "root"
set IPSERV ""
set BackupDirectories "/home/test1 /home/test2"
set TMPDIR "/home/backup5"

spawn ssh $USER@$IPSERV
expect "assword:"
send "$PASS\r"
expect "#"

# Now I need to check if remote directory $TMPDIR is exists !!!!!!!

send "tar -zcvf $TMPDIR/backup.tar.gz $BackupDirectories\r"
expect "#"

send "exit;\r"
expect eof
 
Would:
Code:
if [file exists $TMPDIR] {...}
not work for you (maybe not since I don't know much about EXPECT)?

_________________
Bob Rashkin
 
No.
I have tried this, but this method checks directory existance on local server, but not on remote one.
I think - checking must be via "expect", or other way..
?????
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top