Arikkan
asked on
Download a File for COREFTP using Command line and WILDCARDs in source Filename
Hi,
I want to download a file on COREFTP using the command line and I am trying to use the following command and it works perfectly fine when I use the Wildcards * or ?.
How can I use specific WILDCARDS as [0-9] or [00-31] or [0-1]{2} ?
See below what I am trying to do (File with a Date appended mmddyyyy format)
This command does not work.
C:\Program Files\CoreFTP>coreftp.exe -delsrc -nocase -s -O -site DailyFTPProfile -d /FileLocationOnFTP/Daily_[ 01-12][01- 31][19-20] [0-9][0-9] .txt -p C:\DOWNLOADS\ -FN Daily.txt -log C:\LOGS\Log.txt -output C:\OUTPUT\output.txt -exit
This command works:
C:\Program Files\CoreFTP>coreftp.exe -delsrc -nocase -s -O -site DailyFTPProfile -d /FileLocationOnFTP/Daily_? ???????.tx t -p C:\DOWNLOADS\ -FN Daily.txt -log C:\LOGS\Log.txt -output C:\OUTPUT\output.txt -exit
Any ideas?
I want to download a file on COREFTP using the command line and I am trying to use the following command and it works perfectly fine when I use the Wildcards * or ?.
How can I use specific WILDCARDS as [0-9] or [00-31] or [0-1]{2} ?
See below what I am trying to do (File with a Date appended mmddyyyy format)
This command does not work.
C:\Program Files\CoreFTP>coreftp.exe -delsrc -nocase -s -O -site DailyFTPProfile -d /FileLocationOnFTP/Daily_[
This command works:
C:\Program Files\CoreFTP>coreftp.exe -delsrc -nocase -s -O -site DailyFTPProfile -d /FileLocationOnFTP/Daily_?
Any ideas?
ASKER
Thanks for your quick reply. :-)
But the date on remote file might not be current date.
The file format is:
DAILY__mmddyyyy.txt
I am just trying to add a wildcard to validate the date on file and pick the correct file as there might be other files on the folder like:
DAILY__mmddyyyyIgnoreMe.tx t
DAILY__mmyyyy.txt
DAILY__somenameABCD.txt
DAILY__yyyy.txt
DAILY__14442015.txt -->Wrong Date
But the date on remote file might not be current date.
The file format is:
DAILY__mmddyyyy.txt
I am just trying to add a wildcard to validate the date on file and pick the correct file as there might be other files on the folder like:
DAILY__mmddyyyyIgnoreMe.tx
DAILY__mmyyyy.txt
DAILY__somenameABCD.txt
DAILY__yyyy.txt
DAILY__14442015.txt -->Wrong Date
DAILY__mmddyyyyIgnoreMe.txt
DAILY__mmyyyy.txt
DAILY__somenameABCD.txt
DAILY__yyyy.txt
Are these correct files?
ASKER
Yes. They might have names like these.
I just want the file with
DAILY__mmddyyyy.txt
to be picked
I just want the file with
DAILY__mmddyyyy.txt
to be picked
Is COREFTP the only possible FTP client you can use?
~bp
~bp
I think you have a couple of options.
~bp
1. [b]Use a different FTP client[/b]
You may be able to find a different FTP client that allows REGEX patterns to be specified for the FTP get files command. The only one I know of that I think this supports (I've never actually used it) is WGET, but perhaps there are others. One of my favorite tools for scripted FTP is NCFTPGET, but it does not support REGEX.2. [b]Filter a list of files locally[/b]
The other approach I can see is a multistep process. You could first do an FTP command to get a list of all the files on the server that match your basic "????????" pattern, and then on the local PC use scripting to select by REGEX the desired files from that list. Then take that list of matching files and use it to drive one or more FTP gets from the remote server.~bp
ASKER
Yes. I can use only COREFTP in our environment as it is already deployed at client side.
Then, I have to go with OPTION2: Filter a list of files locally.......
I can use a batch file to call COREFTP, so I need to do the following:
1. Use Command to get list of files on FTP for COREFTP
2. Get the correct file using scripting on local PC --> Do you know how I should do this?
3. Call COREFTP and download the selected file.
Then, I have to go with OPTION2: Filter a list of files locally.......
I can use a batch file to call COREFTP, so I need to do the following:
1. Use Command to get list of files on FTP for COREFTP
2. Get the correct file using scripting on local PC --> Do you know how I should do this?
3. Call COREFTP and download the selected file.
I am just trying to add a wildcard to validate the date on file and pick the correct file as there might be other files on the folder like:So you want all valid dates, right?
DAILY__mmddyyyyIgnoreMe.txt
DAILY__mmyyyy.txt
DAILY__somenameABCD.txt
DAILY__yyyy.txt
DAILY__14442015.txt -->Wrong Date
~bp
Here's an example command you could use in batch to filter out just files you want.
findstr -i -r -c:"daily_[01][0-9][0-3][0-9][12][901][0-9][0-9]\.txt" in.txt > out.txt
~bp
ASKER
Thank you. I will try it and let you know. :-)
ASKER
1. Use Command to get list of files on FTP for COREFTP --> Cant seem to find this. Probably CoreFTP does not support it......
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Open in new window