rename files in remote server via ftp | Unix Linux Forums | Shell Programming and Scripting

  Go Back    


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

rename files in remote server via ftp

Shell Programming and Scripting


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 12-13-2007
dineshr85 dineshr85 is offline
Registered User
 
Join Date: Oct 2007
Last Activity: 4 January 2008, 6:15 AM EST
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
rename files in remote server via ftp

Hi All,

I want to rename set of files in the remote server which iam unable to do . i can rename only one file
at a time . for example
ftp $REMOTESERVER
{
rename $NAME1 $NAME2
} is working


whereas

ftp $REMOTESERVER
{
rename $NAME1*.dat $NAME2*.data
} is not working ... Its checking for the file $NAME1*.dat

any suggestions
Sponsored Links
    #2  
Old 12-13-2007
porter porter is offline Forum Advisor  
Registered User
 
Join Date: Jan 2007
Last Activity: 8 January 2008, 6:50 PM EST
Posts: 2,965
Thanks: 0
Thanked 5 Times in 5 Posts
Yes, rename one file at a time.

You can't really have a wild card for the target unless you want the rename to replace an existing file.

Also, any expansion of the wildcard would give multiple arguments, and rename can only really deal with two.
Sponsored Links
    #3  
Old 12-13-2007
dineshr85 dineshr85 is offline
Registered User
 
Join Date: Oct 2007
Last Activity: 4 January 2008, 6:15 AM EST
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
i dont know the file name

i dont know the file name - there will be files named like name 2 , name 34 , name 43564, name 355 so lets say i want to rename the files that start with name can i do it ... or is there any other way to change the extn alone.
    #4  
Old 12-13-2007
porter porter is offline Forum Advisor  
Registered User
 
Join Date: Jan 2007
Last Activity: 8 January 2008, 6:50 PM EST
Posts: 2,965
Thanks: 0
Thanked 5 Times in 5 Posts
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.
Sponsored Links
    #5  
Old 02-20-2008
ZyxKor ZyxKor is offline
Registered User
 
Join Date: Feb 2008
Last Activity: 20 February 2008, 11:30 AM EST
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
I'm dealing with the same issue save for the fact that I only have access to FTP on the remote machine. I'm running a script on a local Unix system and connecting to a FTP server on a windows box. What I need to do is move files from \today\*.PDF to \yesterday\*.PDF. All the files I'm moving are PDF's and there are other files in today's folder that I will not be moving. I tried using the "rename *.pdf \yesterday\*" gives the error:

Quote:
550 *.txt: The filename, directory name, or volume label syntax is incorrect.
I'm not sure what I can do as I am rather limited. I am currently using mget and mput but that takes a ton of bandwidth with these reports. I don't have access to the windows box nor can I install any scripts/programs on it.

I would appreciate any help. Thanks in advance!
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Help with renaming files in remote server infossiva Shell Programming and Scripting 0 02-07-2012 10:36 AM
copy files from remote server (B) to target server (A)? Beginer0705 Shell Programming and Scripting 4 07-29-2009 05:24 PM
listing files on remote server vasuarjula AIX 3 06-02-2008 02:23 PM
FTP multiple files from remote server to local server berlin_germany Shell Programming and Scripting 2 12-20-2006 02:24 AM
copying files to a remote aix server using tar! system-admin AIX 2 11-17-2006 02:30 PM



All times are GMT -4. The time now is 05:32 AM.