FTP Command Question

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
74,345
Office Version
  1. 365
Platform
  1. Windows
Anyone here have any FTP scripting experience? We have some automated batch files that connect to a remote FTP server and download files to our FTP server.

This batch file runs daily, but the client doesn't clean out the old files very often. So what we would like to do is to "mark" the files we download so we don't download them again. Unfortunately, the file names are different. The only thing that is consistent is the PGP extension.

So I was hoping that after I download the file to rename it. My script looks something like this:
Code:
<connection/login info here>
cd OurCompany
cd FromVendor
binary
mget *.pgp
rename *.pgp *.old
BYE
The problem is that it doesn't seem to like my RENAME command. I am not sure if the wildcards are presenting the problem.

Can anyone help, or does anyone know of an FTP forum?

Thanks.
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
Would this do instead?

KILL *.pgp

...to clean out the directory. BTW, are you running VBScript, or something else?

Denis
 
Upvote 0
Denis,

No, they are actually FTP commands (you can find lists of them on the internet). To delete files, there is actually a DELETE command. However, I woul prefer to rename them rather than delete them, as sometimes there are errors in the downloads, so I may need access to them. Another possibility is that if new files are being added as you are downloading, you may delete one that you have not downloaded yet.
 
Upvote 0
OK, I thought you were running some DOS-based code.

Went for a browse, and this page says that you need to use a pipe symbol with wildcard names:

Code:
<connection/login info here> 
cd OurCompany 
cd FromVendor 
binary 
mget *.pgp 
rename *.pgp|*.old 
BYE

Denis
 
Upvote 0
Denis,

No luck. I keep getting an error message saying:
"The filename, directory name, or volume label syntax is incorrect."

I tried using the RENAME command on one specific filename (no wildcards) and it worked. But I cannot get it to do multiple file names with wildcards.
 
Upvote 0

Forum statistics

Threads
1,225,358
Messages
6,184,497
Members
453,236
Latest member
Siams

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top