Sponsored Content
Top Forums Shell Programming and Scripting rename files in remote server via ftp Post 302150942 by porter on Thursday 13th of December 2007 04:23:49 AM
Old 12-13-2007
You could use ftp to get a directory listing, then once you have that list you can determine how to rename the files.

Remember with UNIX files names there is nothing magic about a file's extension.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

FTP multiple files from remote server to local server

Hi, I am facing a weired problem in my FTP script. I want to transfer multiple files from remote server to local server everyday, using mget * in my script. I also, want to send an email for successful or failed FTP. My script works for file transfer, but it don't send any mail. There is... (2 Replies)
Discussion started by: berlin_germany
2 Replies

2. UNIX for Dummies Questions & Answers

Can I copy files on remote server with ftp ?

I just realize the only way is to download and upload again.. is not possible to copy them remotely with the ftp protocol ? thanks (2 Replies)
Discussion started by: aneuryzma
2 Replies

3. Shell Programming and Scripting

preserving the timestamp of a file when copied from remote server to local server using ftp

Hi, I need to copy few files from remote server to local server. I write a shell script to connect to the remote server using ftp and go to that path. Now i need to copy those files in the remote directory to my local server with the timestamp of all those files shouldnt be changed. ... (5 Replies)
Discussion started by: arunkumarmc
5 Replies

4. HP-UX

[Solved] Unable to rename file in ftp server .Net:FTP perl

Hello All, I am trying to connect to ftp server and get the files. Also i need to rename the file in other ftp dir. rename method is not allowing me to rename the file in other dir. When i tried copy command by using net::FTP:FILE then perl says it is not installed. Can some body help me to... (2 Replies)
Discussion started by: krsnadasa
2 Replies

5. Shell Programming and Scripting

ftp'ing multiple files to the remote server

unix shell script (2 Replies)
Discussion started by: giridhar276
2 Replies

6. Shell Programming and Scripting

FTP files from different directory from remote server to one directory in local

Hi All, I want to search for .log files from folders and sub folders in remote server and FTP them to one particular folder in the local machine. I dont want to copy the entire directory tree structure, just have to take all the .log files from all the folders by doing a recursive search from the... (3 Replies)
Discussion started by: dassv
3 Replies

7. Shell Programming and Scripting

Copy down remote files and rename them to include the server name with full path

I need to pull down a good bit of files for another support team for an upgrade project. I have a server.list with all of the server names. I need to do two parts: FIRST: I have this example, but it does not list the server name in front of each line. #! /bin/bash for server in $(<... (10 Replies)
Discussion started by: asnatlas
10 Replies

8. Shell Programming and Scripting

Rename Files in remote directory

Hi All, I am creating a script which will connect to remote server with ssh and perfom below. - Search in a directory - Search for a pattern - Check the size if greater than the size_limit rename the file. Below is the code i have written. ssh user@host <<EOF find /tmp... (5 Replies)
Discussion started by: Girish19
5 Replies

9. Shell Programming and Scripting

Script connect to remote server, not find files and exit only from remote server, but not from scrip

I have a script, which connecting to remote server and first checks, if the files are there by timestamp. If not I want the script exit without error. Below is a code TARFILE=${NAME}.tar TARGZFILE=${NAME}.tar.gz ssh ${DESTSERVNAME} 'cd /export/home/iciprod/download/let/monthly;... (3 Replies)
Discussion started by: digioleg54
3 Replies

10. Shell Programming and Scripting

Rename (move) multiple files on remote server using sftp

I want to rename (move) multiple files on remote server. I tried the following command to move all TXT files from my_dir directory to /new_dir. But it does not work. Any help? #!/bin/ksh sftp -dev3 << ABC cd my_dir $(for i in TXT; do echo "ls *.$i" ; rename $x /new_dir/$x;... (1 Reply)
Discussion started by: Soham
1 Replies
FTP-UPLOAD(1p)						User Contributed Perl Documentation					    FTP-UPLOAD(1p)

NAME
ftp-upload - batch transfer local files to an FTP server SYNOPSIS
ftp-upload [any-switch]... {[repeatable-switch]... file...}... DESCRIPTION
ftp-upload is used to send local files to an FTP server. It isn't interactive, it's meant to be used from scripts. It is disciplined about its exit value and it doesn't output informational messages by default. There are two kinds of switches. Initial switches have to appear before any filenames, they affect the session as a whole. Repeatable switches can appear interspersed with the file names, they affect the transfer of the files which appear after them on the command line. OPTIONS
Initial switches These have to be used before any file names listed on the command line. --debug Turn debugging on. --help Show the usage message and die. --ignore-quit-failure Don't complain or set a failure exit code just because the QUIT command fails. This can be necessary because some servers, in blatant disregard of RFC 959, close the command channel when you send them an ABOR command. -v, --verbose Print informational messages to stdout. --version Show the version number and exit. Initial switches which specify connection information These also have to be used before any file names listed on the command line. They specify the information used to set up the FTP connec- tion. --account account This specifies the account to be used when logging into the remote system. This is distinct from the user name used to log in. Few systems need this. There is no default. -h, --host host Specify the host to which to connect. There is no default, you have to specify this switch. --passive Force the use of passive (PASV) transfers. Passive transfers are required with some firewall configurations, but if you have such you'd do better to configure Net::FTP so that it knows when to use them (see Net::Config). If you need to use passive transfers with certain (broken) servers, however, this switch is your best bet. Alternatively, you can set $FTP_PASSIVE to 1 in the environment (see Net::FTP). --password pw This gives the password which will be used to login. The default is your email address. Note that you should not specify a real (secret) password this way, as on most systems anybody on the machine can see the arguments you pass to your commands. Use one of other password-setting switches instead. -s, --password-stdin This tells ftp-upload to read the password from standard input. No prompt will be printed, and a single line will be read. Most peo- ple will use this switch to specify the password. Eg, echo 3x9sjJJh | ftp-upload -sh $host -u $user $file Using echo this way is safe where the --password switch isn't if the echo command is built in to the shell. --password-fd fd This is like --password-stdin except that it reads the password from the file descriptor numbered fd. ftp-upload -h $host -u $user --password-fd=3 3<$pw_file $file -u, --user user Specify the user name to use when logging in. The default is "anonymous". Repeatable switches These switches can be used anywhere on the command line (except after the last file name). They affect the transfer of files listed after them. --as remote-name Normally a file is transferred using the same name it has locally. If you use this switch the next file transferred will be called remote-name on the other host instead. ftp-upload --host $host --as index.htm index.html -a, --ascii Perform transfers in ASCII mode. -b, --binary Perform transfers in binary mode. This is the default. -d, --dir dir Change directory to dir on the FTP server before continuing. You can use this multiple times between files, ftp-upload will chdir once for each time you specify it. Using ".." as the dir will cause an FTP "CDUP" to be done rather than a "CWD". --full-path Normally uploaded files go into the current directory on the remote host, even when the local file name given contains slashes. Eg, if you say ftp-upload -h $host /etc/motd ftp-upload will upload the file as motd, not /etc/motd. This differs from how the standard ftp program works, and it also differs with how ftp-upload worked before version 1.3. If you specify --full-path, you'll get the other behavior. A request to upload dir/file will tell the server to store dir/file rather than file. When you use --as the --full-path setting doesn't matter. --full-path only tells the program what name to use when it's choosing the name. --no-full-path Disable --full-path. This is the default. -l, --ls Try to get a remote directory listing of files after transferring them. I say "try" because there's no guaranteed way to do this with the FTP protocol. The command I run is "LIST file". This will generally work if file doesn't contain any special characters. -L, --no-ls Disable the --ls behavior. --tmp-none Transfer files directly, don't do anything special to try to ensure that they don't appear under their real names on the remote machine until the transfer is finished. Each file is transferred with a single simple "STOR". This is the default. --tmp-samedir Transfer files to the remote machine using a temporary name, then rename them when the transfer finishes. This won't work if the remote server doesn't give a recognizable response to the "STOU" command. If the server's response to "STOU" isn't recognized by Net::FTP but is reasonable, Graham Barr might be willing to change Net::FTP to recognize it. If you like you can send the "--debug" output to me and I'll coordinate such requests. --tmp-dir dir Transfer files to dir on the remote host, then rename them when the transfer is complete. This is safer than --tmp-samedir because it doesn't use "STOU" and so it works with more servers. ftp-upload -h $host --tmp-dir incoming $file --tmp-format fmt Transfer files to "sprintf(fmt, file base name)", then rename them when the transfer is complete. Like --tmp-dir, this is safer than --tmp-samedir because it doesn't use "STOU" and so it works with more servers. ftp-upload -h $host --tmp-format tmp.%s $file AUTHOR
Roderick Schertler <roderick@argon.org> perl v5.8.7 2006-03-16 FTP-UPLOAD(1p)
All times are GMT -4. The time now is 01:58 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy