![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Rules & FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Find, Append, Move & Rename Multiple Files | Trapper | Shell Programming and Scripting | 5 | 08-30-2007 04:39 AM |
| trying to rename the files in dir | hankooknara | Shell Programming and Scripting | 8 | 07-02-2007 12:36 AM |
| Move and rename files in seq. with padded digits | rocinante | Shell Programming and Scripting | 9 | 06-09-2007 07:37 PM |
| Move files and rename ?? | sabercats | Shell Programming and Scripting | 1 | 03-22-2006 12:16 PM |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Using Rename to move files
I am connecting to a remote server (Unix) and doing a ftp dowmload of files. The script (VB script) works fine except for not being able to move the downloaded files on the remote server to another folder.
I need to move all files with an .asc extesnion from folder "tovecellio_edi" to folder "tovecellio_edi/backup" and jeep the same name. The code I have allows me to move a single file but I have problems with moving files using wildcard. Here is my code: Code:
Set objMyFile = objFSO.CreateTextFile(strFTPScriptFileName, True)
objMyFile.WriteLine ("open " & strFTPServerName)
objMyFile.WriteLine (strLoginID)
objMyFile.WriteLine (strPassword)
objMyFile.WriteLine ("cd " & strFTPServerFolder)
objMyFile.WriteLine ("bin")
objMyFile.WriteLine ("lcd " & strLocalFolderName)
objMyFile.WriteLine ("prompt off")
objMyFile.WriteLine ("mget " & strFilePut)
objMyFile.WriteLine ("rename tovecellio.*.asc backup/tovecellio*.asc")
objMyFile.WriteLine ("disconnect")
objMyFile.WriteLine ("bye")
objMyFile.Close
Code:
objMyFile.WriteLine ("mget " & strFilePut)
objMyFile.WriteLine ("rename tovecellio_edi.d0419.t142118.asc backup/tovecellio_edi.d0419.t142118.asc")
|
| Forum Sponsor | ||
|
|
|
|||
|
As an alternative, I solved a similar problem by creating a file on the Windows side that looked like:
rename a.asc backup/a.asc rename b.asc backup/b.asc mget * quit for each file that was received and processed successfully. Then this file was used as input to ftp in the next download and moves the processed files ahead of the mget. This allowed for re-running of the download if any of the files were corrupted. There is another advantage to this procedure in that if a file is added to the unix directory while a download is taking place, it may not be transferred, and if you move all the files, that new file may be moved without ever being processed, whereas by only moving the files that have been processed, you preclude that possibility. Last edited by jgt; 04-09-2008 at 10:07 AM. |
|||
| Google UNIX.COM |