The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


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 !!

More UNIX and Linux Forum Topics You Might Find Helpful
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

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-09-2008
Registered User
 

Join Date: Apr 2008
Posts: 1
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
If I do like this, moving a single file it works:

Code:
objMyFile.WriteLine ("mget " & strFilePut)
objMyFile.WriteLine ("rename tovecellio_edi.d0419.t142118.asc backup/tovecellio_edi.d0419.t142118.asc")
Thank you.
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 04-09-2008
jgt jgt is offline
Registered User
 

Join Date: Apr 2007
Location: 44.21.48N 80.50.15W
Posts: 348
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.
Reply With Quote
Google UNIX.COM
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 11:57 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0