Running script on SFTP server, RMDIR and RM with wildcards
Im going insane trying to figure out what i consider a basic command on an SFTP server...
Im trying to download all files from a directory *done*
then remove all the files (and sometimes folders that contain files) i have downloaded on the remote directory...
Bumping up posts or double posting is not permitted in these forums.
Please read the rules, which you agreed to when you registered, if you have not already done so.
You may receive an infraction for this. If so, don't worry, just try to follow the rules more carefully. The infraction will expire in the near future
Thank You.
The UNIX and Linux Forums.
---------- Post updated at 11:52 ---------- Previous update was at 11:44 ----------
Taking a look at man sftp, I see two commands that would match:
Both take no arguments. 'rm', in this case is only for files, while 'rmdir' is only for empty directories. Both are completely independent of the usual shell commands you might know, but are instead a part of the SSH server (sftp module).
You can probably remove all the files you fetched using 'rm *' (assuming you have the rights to do so), but you'll have to descend into each directory you got, remove the files, and then remove the directory.
A faster, but less portable, way would be to fetch the files using sftp, and then delete them using
Be advised, though, using 'rm -r' without care can easily result in a damaged system, and should be avoided where ever possible.
Hello,
In our Data Warehouse environment, before our batch SFTP jobs kick off to pull the files from remote servers, I would like to setup a pre-sftp job that would test if all the remote servers from where the files are being pulled, are up and running. If any one of the remote serer is... (2 Replies)
Hello All,
I am trying to run a sftp batch script (.conf) file from a shell script. I wanted to remove a file from sftp if it exists else it should ignore removing and continue with other commands in .conf file. I am not able to put logic in .conf file.Any idea how that can be achieved.
... (2 Replies)
Hi guys,
So i am in server1 and i have to login to server 2, 3,4 and run some script there(logging script) and output its result. What i am doing is running the script in server2 and outputting it to a file in server 2 and then Scp'ing the file to server1. Similarly i am doing this for other... (5 Replies)
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)
Hi,
I am trying to automate the process of fetching files from remote server to local server through sftp. I have the username and password for the remote solaris server. But I need to give password manually everytime i run the script.
Can anyone help me in automating the script such that it... (3 Replies)
I have 3 servers A, B, C and server B is having some files in /u01/soa/ directory, these files i want to copy to server C, and i want to run the script from server A.
Script(Server A) --> Files at Server B (Source server) --> Copy the files to Server C(Target Server).
We dont have RSA key... (4 Replies)
When I manually run a sftp to a remote server I receive the following output on he screen;
Uploading filename to /inbound/xxxxxxx_Folder_1/filename
filename 100% 50 0.1KB/s ... (1 Reply)
When I manually sftp a file to a remote server I get the following output on the screen;
Uploading filename to /inbound/xxxxxxx_Folder_1/filename
filename 100% 50 0.1KB/s 00:00
When I run the commands from within a shell script I do not get the "filename ... (0 Replies)