FTP Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsSystem AdministrationFTP Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old May 15th, 2003, 04:54 PM
spooky1121 spooky1121 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2003
Posts: 5 spooky1121 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
FTP rename problem

I have a set of files I need to transfer via ftp. Transferring is no problem, batched it out already. The problem comes from the need to rename the files before (or after) transfer.
All files have the same six digit numerical filename, with a 3 digit sequential numeric filename extension, ascending order. I can rename these files only if I know the extension number value. In an automatic batch process, I won't know that value.
For example: 123456.001 needs to become 654321a.001. The filenames are static, the extensions are variable. Help.

Reply With Quote
  #2  
Old May 16th, 2003, 05:34 AM
realnowhereman realnowhereman is offline
Not there when you need me
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Oct 2001
Location: Berlin, Germany
Posts: 1,438 realnowhereman User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 17 m 46 sec
Reputation Power: 8
After you've uploaded everything, obtain a directory listing (e. g. by using the dir command) and get the filenames from it. Then do the renaming.

Reply With Quote
  #3  
Old May 16th, 2003, 10:42 AM
spooky1121 spooky1121 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2003
Posts: 5 spooky1121 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
My real desire here is to automate the rename process in a batch file. I really don't even know if this is possible without manually supplying the filename extension in the batch. Wildcards dont work.
ie.
prompt
rename 123456.* 654321i.*
file cant be renamed

rename 123456.001 654321i.001
file succesfully renamed

in batch.

Reply With Quote
  #4  
Old May 16th, 2003, 10:55 AM
realnowhereman realnowhereman is offline
Not there when you need me
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Oct 2001
Location: Berlin, Germany
Posts: 1,438 realnowhereman User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 17 m 46 sec
Reputation Power: 8
I think DOS batch files are not really appropiate in this case. How about VBS or JS?

Reply With Quote
  #5  
Old May 16th, 2003, 10:59 AM
spooky1121 spooky1121 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2003
Posts: 5 spooky1121 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Ewww... I suppose I could transfer using FTP and build an applet to go to the downloaded files and rename them. I am only toes wet in Visual Basic. Java I know less about. Any idea of the difficulty?

Reply With Quote
  #6  
Old May 16th, 2003, 11:10 AM
realnowhereman realnowhereman is offline
Not there when you need me
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Oct 2001
Location: Berlin, Germany
Posts: 1,438 realnowhereman User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 17 m 46 sec
Reputation Power: 8
As far as I understand you're going to rename first, upload later anyway. So what I meant to say is that you could use the Wintendo Scripting Host to write a script to do the renaming. As for the languages and methods, they're relatively easy to learn and use. Since you've already got some Basic experience, you can try writing a VBScript script. Just use the FileSystemObject and iterate through the files which you want to rename. If you don't know how, check out M$'s docs on the WSH (which contain a documentation on the FileSystemObject) and of course feel free to ask here for more details

JScript has not anything to do with Java, btw.

Reply With Quote
  #7  
Old May 16th, 2003, 02:23 PM
spooky1121 spooky1121 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2003
Posts: 5 spooky1121 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Okay, researched and came up with a create object script and a move file method of renaming. I need to expand this however to get the file name extension and provide it instead of wild cards.
So, to line out the entire process, I have files in a folder with static and itentical filenames, 123456, and variable and ascending filename extensions .001 thru .999. Usually only 1 to five files at a time. I want to script a process to reach out, rename the filename, but not the extension. I won't inherently know the extension ahead of time. I can see two possible ways of doing this, one is somehow "getting" the filename extension and providing the results in the line to move/rename, or providing variables for all 999 possibilities in the code along with a "if exist, do this" sort of statement.
Do either of these hypotheses sound like I'm on the right track?

Reply With Quote
  #8  
Old May 16th, 2003, 03:15 PM
realnowhereman realnowhereman is offline
Not there when you need me
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Oct 2001
Location: Berlin, Germany
Posts: 1,438 realnowhereman User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 17 m 46 sec
Reputation Power: 8
Yes!!

However, try to implement the first way, not the second. The second would work too, but it's not elegant at all.

Reply With Quote
  #9  
Old May 16th, 2003, 03:19 PM
spooky1121 spooky1121 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2003
Posts: 5 spooky1121 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
My Thanks

realnowhereman, my thanks. I'll argue with the VB script over the weekend and let you know. Thanks for showing me the door. By the way, IF your name is a reference to the timeless supergroup from Liverpool, they rule. IF not, it doesn't make the "ruling" statement any less true.
Thanks again.

Reply With Quote
Reply

Viewing: Dev Shed ForumsSystem AdministrationFTP Help > FTP rename problem


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
Stay green...Green IT