Check the size of the file on different server


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Check the size of the file on different server
# 1  
Old 02-06-2010
MySQL Check the size of the file on different server

Hello,

I have two servers A and B, My script is written on Server A. I am picking up the file say "abc.txt" from Server B using sftp command and putting it in a directory at Server A.

Now the catch is, If the file size of "abc.txt" is greater thn the available size on Server A, thn an email should be sent with the error msg.

question::
1) How to check the size of the file "abc.txt" from server A. I tried ls -ltr abc.txt on ftp prompt but its not working

Please Help

Thanks in advance
# 2  
Old 02-06-2010
IS the remote server windows or unix?

Do you mean ftp or sftp you mention both?
# 3  
Old 02-06-2010
remote server is Unix.

i am usind sftp command to get the file but tried to get the file size using ftp also.
# 4  
Old 02-07-2010
Quote:
Originally Posted by Prashant Jain
remote server is Unix.

i am usind sftp command to get the file but tried to get the file size using ftp also.
If you use sftp, then ssh is likely to work, too? Then just do

ssh name@B.remote.net stat -f "%z" /location/of/large/file
# 5  
Old 02-08-2010
As you are using SFTP, you can check file size of "abc.txt" before getting the file from server B using below command in sftp prompt.
Quote:
sftp> !ls -l while.sh > fs.txt
! can be used in sftp prompt to execute local commands.Now fs.txt file created on server A contains file size.
Note: I have tested this in Solaris.
-Nithin.
# 6  
Old 02-09-2010
My script is written on server A and we are picking up the file from B to A.

Now when i am connecting to server B from A using sftp:

A-sftp> If i write !, in this case i will get the size of files on local server A, but i want the size of the file which is located on server B. So that i if the file size is big, i won't import it to server A

I am using AIX version 4.3.3.0

Thanks For your help.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

File size check

I am trying to check whether two files are empty or not using below if condition but its checking for only one file if ] Again I tried if && ] Need your assistance (2 Replies)
Discussion started by: Aditya_001
2 Replies

2. Shell Programming and Scripting

Check a file size

I'm doing a script thats check if mylogfile.log is bigger then 5000 but i dont know how to write it. thanks in avance. (6 Replies)
Discussion started by: Froob
6 Replies

3. Shell Programming and Scripting

Check the partition size on server

Dear All, I need notification mail from server while device size crossed 80% approximately.I tried following shell .its working fine when the device name like /dev/sdc1 etc.Its not working in LVM name.For example Script: #!/bin/sh echo "Storage server space details"; df -H | grep -vE... (4 Replies)
Discussion started by: kpoobathi
4 Replies

4. Shell Programming and Scripting

check the file size

if ; then cp /tmp/testfolder/*.* ~/new/logs/ else echo "No files today" exit fi The problem is this doen't work when there is more than 1 file. Please tell me how to take the latest file and check the size of the file in a directory (1 Reply)
Discussion started by: sandy1028
1 Replies

5. UNIX for Advanced & Expert Users

Check the size of the file on different server

Hello, I have two servers A and B, My script is written on Server A. I am picking up the file say "abc.txt" from Server B using sftp command and putting it in a directory at Server A. Now the catch is, If the file size of "abc.txt" is greater thn the available size on Server A, thn an email... (1 Reply)
Discussion started by: Prashant Jain
1 Replies

6. Shell Programming and Scripting

Check for file size is zero or not.

I have following script on AIX/KSH if ] ; then echo "filename exists and is > 0 bytes" else echo "filename does not exist or is zero length" fi It is not working. What is wrong here??? (3 Replies)
Discussion started by: Hangman2
3 Replies

7. Shell Programming and Scripting

To check file size

Hi All, I am in small problem.. i have one script which transfers some big files to my ftp usign normal command like put .... my problem is how to check whether my file have been transferred successfully on ftp or not... i know only inside ftp we have option like 'size' command which... (2 Replies)
Discussion started by: Shahul
2 Replies

8. Shell Programming and Scripting

how to connect to server with ssh to check process size

Hello i have to connect to 11 servers to check the process size on every server. how to that with shell scripting using ssh regards (7 Replies)
Discussion started by: mogabr
7 Replies

9. Solaris

command to find out total size of a specific file size (spread over the server)

hi all, in my server there are some specific application files which are spread through out the server... these are spread in folders..sub-folders..chid folders... please help me, how can i find the total size of these specific files in the server... (3 Replies)
Discussion started by: abhinov
3 Replies

10. UNIX for Dummies Questions & Answers

Check file size

I need a unix script that will check the size of multiple files in the same directory or from a text file. (6 Replies)
Discussion started by: alnita
6 Replies
Login or Register to Ask a Question