Sponsored Content
Top Forums Shell Programming and Scripting Sftp some files from windows server to UNIX server Post 302761381 by RudiC on Friday 25th of January 2013 02:04:41 PM
Old 01-25-2013
What about reading the man stfp page? No if, no else, no mv, but:
Quote:
NAME
sftp — secure file transfer program
.
.
.
rename oldpath newpath
Rename remote file from oldpath to newpath.
So - check for existence of control file with e.g. ssh ... ls, then get and rename files with sftp.

BTW - your here document is missing its final token (EOF)
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

SFTP from windows E:/ to unix server

Hello All :), I am making a script in the ksh to Secure FTP a set of files from the E:/ drive in windows a computer to a unix server. Had it been in the unix directory, I could have used the expect utility to use the non-interactive mode for sftp, #!/usr/local/bin/expect #!/bin/ksh ... (12 Replies)
Discussion started by: pranavagarwal
12 Replies

2. Shell Programming and Scripting

SFTP failure from unix to windows server

Hi, I am having unix server SUNW,Sun-Fire-V245. remote windows server details: Microsoft Windows In my script i am sftp'ing files to the windows server through sftp command. But the problem i am facing is, some files are successfully sftp'd to windows server and for some files sftp is... (0 Replies)
Discussion started by: syamkp
0 Replies

3. Shell Programming and Scripting

FTPing files from unix server to windows server

Hi, Below is the script which ftps the file from unix server and putting in a different directory(but on unix server) How can i ftp the files from unix server and to place in a secure location on windows server? what changes needs to be done to the below script? How can this be... (1 Reply)
Discussion started by: venkatesht
1 Replies

4. Shell Programming and Scripting

Error copying files from Unix (Solaris10) to Windows Server 2003 using scp/sftp

Hi, I have generated a Public/Private Key Pair in Solaris Unix (source) server and deployed the Public key in Windows 2003(target) server .ssh directory of user profile. When i try to connect(ssh, scp, sftp) from Unix, i'm getting below error message. Sun_SSH_1.1, SSH protocols 1.5/2.0,... (0 Replies)
Discussion started by: ajaykumarb
0 Replies

5. Shell Programming and Scripting

Unix shell script to Copy files from one Windows server to another Windows server.

Can anybody please help me on how to code for the below requirement: I need to write a shell script (on different unix server) to copy files from multiple folders (ex. BRN-000001) from one windows server (\\boldls-mwe-dev4)to a different windows server(\\rrwin-ewhd04.ecomad.int). This shell... (4 Replies)
Discussion started by: SravsJaya
4 Replies

6. IP Networking

How to transfer files from UNIX server to windows machine or vice versa using ftp or sftp commands?

hi, i want to write a shell script code which transfers files from a directory in unix server to a directory in a windows machine.. can any1 give me a sample code which uses ftp or sftp command.. thanks very much, (3 Replies)
Discussion started by: Little
3 Replies

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

8. Solaris

FTP-ing files from Windows server to UNIX server

I need to transfer files from a Windows server to the Unix server and have to run some shell script on it to get the required output. Is it possible to transfer files from Windows server to unix server through any shell script? If so can you please help me with the details. Thanks in... (8 Replies)
Discussion started by: ssk250
8 Replies

9. Shell Programming and Scripting

Copying the files to Windows server from UNIX server

Hi Team, I had a requirement to write a shell script which automatically transfer the files from unix server to windows server. I can able to unix to unix using Scp command. I am not sure how to do unix to windows. I am very new on this concept. Could you please help me or guide in... (4 Replies)
Discussion started by: gvkumar25
4 Replies

10. Shell Programming and Scripting

Do I require remote login access to a windows server to transfer files from a UNIX server

Hi All I need to transfer a file from a UNIX server to a windows server. I saw that it is possible to do this using scp command by looking at the forum listed below: ... (2 Replies)
Discussion started by: vx04
2 Replies
RENAME(2)						     Linux Programmer's Manual							 RENAME(2)

NAME
rename - change the name or location of a file SYNOPSIS
#include <stdio.h> int rename(const char *oldpath, const char *newpath); DESCRIPTION
rename() renames a file, moving it between directories if required. Any other hard links to the file (as created using link(2)) are unaf- fected. Open file descriptors for oldpath are also unaffected. If newpath already exists it will be atomically replaced (subject to a few conditions; see ERRORS below), so that there is no point at which another process attempting to access newpath will find it missing. If oldpath and newpath are existing hard links referring to the same file, then rename() does nothing, and returns a success status. If newpath exists but the operation fails for some reason rename() guarantees to leave an instance of newpath in place. oldpath can specify a directory. In this case, newpath must either not exist, or it must specify an empty directory. However, when overwriting there will probably be a window in which both oldpath and newpath refer to the file being renamed. If oldpath refers to a symbolic link the link is renamed; if newpath refers to a symbolic link the link will be overwritten. RETURN VALUE
On success, zero is returned. On error, -1 is returned, and errno is set appropriately. ERRORS
EACCES Write permission is denied for the directory containing oldpath or newpath, or, search permission is denied for one of the directo- ries in the path prefix of oldpath or newpath, or oldpath is a directory and does not allow write permission (needed to update the .. entry). (See also path_resolution(7).) EBUSY The rename fails because oldpath or newpath is a directory that is in use by some process (perhaps as current working directory, or as root directory, or because it was open for reading) or is in use by the system (for example as mount point), while the system considers this an error. (Note that there is no requirement to return EBUSY in such cases--there is nothing wrong with doing the rename anyway--but it is allowed to return EBUSY if the system cannot otherwise handle such situations.) EDQUOT The user's quota of disk blocks on the file system has been exhausted. EFAULT oldpath or newpath points outside your accessible address space. EINVAL The new pathname contained a path prefix of the old, or, more generally, an attempt was made to make a directory a subdirectory of itself. EISDIR newpath is an existing directory, but oldpath is not a directory. ELOOP Too many symbolic links were encountered in resolving oldpath or newpath. EMLINK oldpath already has the maximum number of links to it, or it was a directory and the directory containing newpath has the maximum number of links. ENAMETOOLONG oldpath or newpath was too long. ENOENT The link named by oldpath does not exist; or, a directory component in newpath does not exist; or, oldpath or newpath is an empty string. ENOMEM Insufficient kernel memory was available. ENOSPC The device containing the file has no room for the new directory entry. ENOTDIR A component used as a directory in oldpath or newpath is not, in fact, a directory. Or, oldpath is a directory, and newpath exists but is not a directory. ENOTEMPTY or EEXIST newpath is a nonempty directory, that is, contains entries other than "." and "..". EPERM or EACCES The directory containing oldpath has the sticky bit (S_ISVTX) set and the process's effective user ID is neither the user ID of the file to be deleted nor that of the directory containing it, and the process is not privileged (Linux: does not have the CAP_FOWNER capability); or newpath is an existing file and the directory containing it has the sticky bit set and the process's effective user ID is neither the user ID of the file to be replaced nor that of the directory containing it, and the process is not privileged (Linux: does not have the CAP_FOWNER capability); or the file system containing pathname does not support renaming of the type requested. EROFS The file is on a read-only file system. EXDEV oldpath and newpath are not on the same mounted file system. (Linux permits a file system to be mounted at multiple points, but rename() does not work across different mount points, even if the same file system is mounted on both.) CONFORMING TO
4.3BSD, C89, C99, POSIX.1-2001. BUGS
On NFS file systems, you can not assume that if the operation failed the file was not renamed. If the server does the rename operation and then crashes, the retransmitted RPC which will be processed when the server is up again causes a failure. The application is expected to deal with this. See link(2) for a similar problem. SEE ALSO
mv(1), chmod(2), link(2), renameat(2), symlink(2), unlink(2), path_resolution(7), symlink(7) COLOPHON
This page is part of release 3.53 of the Linux man-pages project. A description of the project, and information about reporting bugs, can be found at http://www.kernel.org/doc/man-pages/. Linux 2013-01-27 RENAME(2)
All times are GMT -4. The time now is 05:58 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy