I use ScriptFTP to download files with the extension *.PS
When downloaded, they are renamed to *.MPG (can this be easy done inside the script, now I do it after the FTP with a batch file in the task-scheduler)
The FTP session is also started with the task-scheduler, every 15 minutes, so if there 's a new file in the FTP side, it will be downloaded, but, since i rename the files to *.MPG the file is downloaded again and again.
So is there a way i can check it ?
if FILE1.MPG exists local , do NOT download FILE1.PS
if FILE1.MPG does NOT exist local, download file1.PS and rename it after download to FILE1.MPG
this has to be done for all the files on the remote FTP.
I was thinking of using the script :
But I don't know if i can exlude the name with ALL the extensions ?
someting like :
When downloaded, they are renamed to *.MPG (can this be easy done inside the script, now I do it after the FTP with a batch file in the task-scheduler)
The FTP session is also started with the task-scheduler, every 15 minutes, so if there 's a new file in the FTP side, it will be downloaded, but, since i rename the files to *.MPG the file is downloaded again and again.
So is there a way i can check it ?
if FILE1.MPG exists local , do NOT download FILE1.PS
if FILE1.MPG does NOT exist local, download file1.PS and rename it after download to FILE1.MPG
this has to be done for all the files on the remote FTP.
I was thinking of using the script :
FTP Script
someting like :
FTP Script
I use ScriptFTP to download files with the extension *.PSDownload the specified file and save it using a different name.
When downloaded, they are renamed to *.MPG (can this be easy done inside the script, now I do it after the FTP with a batch file in the task-scheduler)
But I don't know if i can exlude the name with ALL the extensions ?http://www.scriptftp.com/forum/viewtopic.php?f=6&t=614
someting like :
ADDEXCLUSION(DOWNLOAD, $item.*)
(how to retrieve the suffix from the name of a file)
Maybe so? Efficiency is not checked. Sorry for my English, I used Google Translate
FTP Script
- $aLocalName = ""
- $aRemoteName = ""
- # $aName = $aFileName
- # $aExt = ""
- # $aExt = TEXTCUT($aFileName, $i+1, TEXTLENGTH($aFileName)-$i)
- $i = 0
- $i = $i-1
- $aLocalName = $aLocalName.$aName."|"
- # $aName = $aFileName
- # $aExt = ""
- # $aExt = TEXTCUT($aFileName, $i+1, TEXTLENGTH($aFileName)-$i)
- $i = 0
- $i = $i-1
- $aRemoteName = $aRemoteName.$aName."|"
- $aFound = 0
- $aFound = 1
I'm testing it at the moment, it looks good, the only thing I had to change was putting the extension in lower case, as the FTP is linux based.
Many thanks for this great help.
I'll let you know when the testing is finished, and if I had to make some changes.
Many thanks for this great help.
I'll let you know when the testing is finished, and if I had to make some changes.
It's not completely OK.
It is strange, but it seems to miss the first LOCAL file in the list.
the REMOTE list is OK
I added a print commando; to view the filenames :
And after a few files it goes wrong, the local and remote files do not match, and they do exist.
It is strange, but it seems to miss the first LOCAL file in the list.
the REMOTE list is OK
I added a print commando; to view the filenames :
FTP Script
- $aLocalName = ""
- $aRemoteName = ""
- # $aName = $aFileName
- # $aExt = ""
- # $aExt = TEXTCUT($aFileName, $i+1, TEXTLENGTH($aFileName)-$i)
- $i = 0
- $i = $i-1
- $aLocalName = $aLocalName.$aName."|"
- # $aName = $aFileName
- # $aExt = ""
- # $aExt = TEXTCUT($aFileName, $i+1, TEXTLENGTH($aFileName)-$i)
- $i = 0
- $i = $i-1
- $aRemoteName = $aRemoteName.$aName."|"
- $aFound = 0
- $aFound = 1
GETLIST(LOCAL_FILES,"*.mpg")
Getting file listing of current local directory
Found 9 files.
Local : JPL_PGM_W26_MON-GNK_N
Local : JPL_PGM_W26_OHL-CER_N
Local : JPL_PGM_W26_STV-LIE_N
Local : JPL_PGM_W27_BEE-OHL_N
Local : JPL_PGM_W27_CER-ZWA_N
Local : JPL_PGM_W27_GNT-MON_N
Local : JPL_PGM_W27_KOR-LOK_N
Local : JPL_PGM_W27_WES-MEC_N
Local :
GETLIST(REMOTE_FILES,"*.ps")
Getting file listing of current remote directory
Found 10 files.
Remote : JPL_PGM_W26_MEC-BEE_N
Remote : JPL_PGM_W26_MON-GNK_N
Remote : JPL_PGM_W26_OHL-CER_N
Remote : JPL_PGM_W26_STV-LIE_N
Remote : JPL_PGM_W27_BEE-OHL_N
Remote : JPL_PGM_W27_CER-ZWA_N
Remote : JPL_PGM_W27_GNT-MON_N
Remote : JPL_PGM_W27_KOR-LOK_N
Remote : JPL_PGM_W27_WES-MEC_N
Remote :
GETFILE2("JPL_PGM_W26_MEC-BEE_N.ps","JPL_PGM_W26_MEC-BEE_N.mpg")
Downloading................. JPL_PGM_W26_MEC-BEE_N.ps as JPL_PGM_W26_MEC-BEE_N.mpg
Update :
With the PRINT commando I tried to debug it.
strange enough, when I set the $aLocalName and $aRemoteNamet to "|" the script works, so I did :
[ScriptFTP]$aLocalName = "|"
$aRemoteName = "|"[/ScriptFTP]
And it works, why ? i don't konw...
With the PRINT commando I tried to debug it.
strange enough, when I set the $aLocalName and $aRemoteNamet to "|" the script works, so I did :
[ScriptFTP]$aLocalName = "|"
$aRemoteName = "|"[/ScriptFTP]
And it works, why ? i don't konw...
I am guided by the section
https://www.scriptftp.com/d/ftp-miscellaneous-commands/getlist
where it is stated:The changes were lines forming the list, the symbol "|" to add an element, but not after.
Sorry for my English, I used google translator
https://www.scriptftp.com/d/ftp-miscellaneous-commands/getlist
where it is stated:
Every ScriptFTP variable contains a text string and the list that this command creates is not an exception. The character "|" is used to separate the items of the list. Therefore, you can also build file lists without GETLIST. For example: $mylist="a.txt|b.txt|c.txt".A checking this code: I got
|1.ftp|AUTOEXEC.BAT|boot.ini|Bootfont.bin|CONFIG.SYS|IO.SYS|Log.txt|MSDOS.SYS|NTDETECT.COM|ntldr|pagefile.sysThus we see an inaccuracy in the documentation and the code should look like this:
FTP Script
- $aLocalName = ""
- $aRemoteName = ""
- # $aName = $aFileName
- # $aExt = ""
- # $aExt = TEXTCUT($aFileName, $i+1, TEXTLENGTH($aFileName)-$i)
- $i = 0
- $i = $i-1
- $aLocalName = $aLocalName."|".$aName
- # $aName = $aFileName
- # $aExt = ""
- # $aExt = TEXTCUT($aFileName, $i+1, TEXTLENGTH($aFileName)-$i)
- $i = 0
- $i = $i-1
- $aRemoteName = $aRemoteName."|".$aName
- $aFound = 0
- $aFound = 1
Sorry for my English, I used google translator
- All times are UTC -