|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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. |
|
#2
|
|||
|
|||
|
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.
__________________
PHP manual | MySQL manual | Apache docs | Linux Documentation Project | Free Software Foundation Smart Questions HOWTO | PHP security | PHP FAQ | Posting HOWTO Wikipedia | English dictionary | Google | News | RFCs Thus Spoke Zarathustra | A Skeptic's Guide to Christianity | Project Gutenberg | Skeptic's Annotated Bible ParEcon | Marxists Internet Archive | The Memory Hole | Landover Baptist | DHMO Research Universal Declaration of Human Rights | UN Charter | Geneva Conventions Sinfest | Chopping Block | Filthy Lies | Bob the Angry Flower | How to Shoot Yourself In the Foot |
|
#3
|
|||
|
|||
|
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. |
|
#4
|
|||
|
|||
|
I think DOS batch files are not really appropiate in this case. How about VBS or JS?
|
|
#5
|
|||
|
|||
|
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?
|
|
#6
|
|||
|
|||
|
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. |
|
#7
|
|||
|
|||
|
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? |
|
#8
|
|||
|
|||
|
Yes!!
![]() However, try to implement the first way, not the second. The second would work too, but it's not elegant at all. |
|
#9
|
|||
|
|||
|
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. |
![]() |
| Viewing: Dev Shed Forums > System Administration > FTP Help > FTP rename problem |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|