I want the FTP command to search for following:
1) Specific file name (for example - "abc.sql")
2) Specific content inside a file (inside .php/.js/.sql/.tpl files)
As there are many folders it will take some time to find that manually.
I am sure there is a command for 1, maybe also for 2, could someone please let me know what I need to enter to find that out. Can you please let me know?
The ftp protocol does not support either operation. You can read the definition of ftp here to see what is possible:
http://www.w3.org/Protocols/rfc959/
An ftp client could implement the search operation by recursively listing directory contents, but to search for contents inside files it would have to download all files.
It's possible that some ftp servers include support for these operations through site specific commands.
Related
is there a way to be able to interact with an SFTP server to perform these two operations:
Delete a file from the server
List the files that are in a folder on the server
Within the documentation I do not see these functionalities:
https://wiki.genexus.com/commwiki/servlet/wiki?44965,GeneXus+SFTP+Module
https://wiki.genexus.com/commwiki/servlet/wiki?44966,SFTP+Client
I am working with GX 17 U9, c#
Reading the GxWiki there is a warning about the use of this module.
I think you have two options:
Develop an external object with a standard library.
Use some command line tool like you could see here https://soic.iupui.edu/technology/kb/sftp/
If you want to do the second way, you can use the shell command:
https://wiki.genexus.com/commwiki/servlet/wiki?8502,Shell%20function
I have a requirement to generate the target file in Informatica with date/time appended to it. How will the Informatica FTP connection identify such dynamic file name with date appended to its name?
Also I would like to know if it is possible to FTP multiple files at a time via Informatica FTP connection. Please someone help me on this.
Its actually pretty simple, you just have to use the part of the file name that is constant and then place a *
for eg:
Myfile_20190607.txt
Myfile_20190507.txt
If i specify Myfile_2019* , this is good enough to pickup the files soecified above. You may have to play with the * and criteria to fit the files that you need.
Note: if you are sending files to third party, try to use SFTP instead of plain old ftp and most organization blocked ftp to outside ip's.
As far as I know until Informatica 9.x, it is neither possible to generate dynamic filename nor create multiple files using FTP connection. Only option was to create the files on Informatica server and then run a script to FTP them over to the destination server.
Here is how:
edit your workflow, choose variables tab, create a workflow
variable with datatype NSTRING; assume the variable name is
$wf_timestamp;
create an assignment task and assign TO_CHAR(SYSDATE,'YYYYMMDD')
to the variable in the assignment task;
edit session: Choose Mapping tab, choose your target; then
Connections; then edit FTP Value; then in the Remote Filename
attribute, enter your filename with the timestemp, eg,
myfile_$$$wf_timestamp.csv;
put your assignment before you session in your workflow.
that's it.
I have a quick project I am working on for one of our VPs.
We have a few thousand CAD jobs stored on a network file share. The file structure is such that there is a parent folder for the CAD job. Part of the folder name contains the job number. Inside the folder, there are 1 to many .ini text files that contain the connection information I need.
What I need is a programatic way to search through all the folders and extract the job number from the folder name, and all the connection values from the ini files.
For example for a folder named CM8252390-3, the job number is 8252390-3. Inside this folder are 3 ini files. Inside the ini files are that look like this:
[Connection]
Name=IMP_Acme_3.5
[Origin]
X=-15.044784
Y=19.620095
Z=44.621395
So my program needs to give me the following result
Job Connection
8252390-3 IMP_Acme1_3.5
8252390-3 IMP_Acme2_3.5
8252390-3 IMP_Acme3_3.5
8254260-1 IMP_Acme3_2.4
8254260-1 IMP_Acme3_4.1
...continued for all folders in the network share
Any suggestion on the best way to do this. I am primarily an Oracle PL/SQL developer, but have some basic Windows batch and Unix shell experience. If I can get the data loaded into Oracle tables, I can search using PL/SQL tools, but is there a better way using shell, batch, or other tools?
Thank you.
I think this is a job for Powershell or vbScript. It would be easy to use these tools to write the information you need to one file.
This file should be written to an Oracle directory.
grant read permission to a database user on this directory
use utl_file to read the file or treat the file as an external table and expose it as a view
schedule a regular OS job to refresh or rebuild the list
I am referring to the Windows-native ftp.exe application. Out-of-the-box, it seems to overwrite files under any and all circumstances.
Is it possible to prevent overwriting files with ftp.exe? If this cannot be done with specific ftp.exe arguments, can it be done using a batch process to call ftp.exe?
I don't think there are any ftp arguments nor ftp command options to do what you want explicitly.
Using a batch process looks like the way to go (if you must stick to this ftp client).
You might have to do something like:
Ftp connect
List files (remote.txt)
Compare remote.txt with local.txt (files you want to upload)
Generate uploadables.txt (containing items from local.txt not in remote.txt)
Ftp connect again
Upload uploadables.txt
Sounds fun, but I better get back to work. :-)
I need to set up some sort of infrastructure to automatically FTP some files from one remote server to another. The FTP transaction will occur on a scheduled basis. Both these servers are Windows boxes and the location of the files that need to be FTP'ed will depend on the current date (the folder they sit in will be named the current day's date).
I would really hate to have to write something like that from scratch, so are there tools/utilities/the likes out there?
Windows command line ftp will read input from a text file. For example:
ftp -ni < ftpscript.txt
Where these options are used:
-n - Suppresses auto-login upon initial connection.
-i - Turns off interactive prompting during multiple file transfers.
The ftpscript.txt would look something like this:
open ftp.mycompany.com
user someuser password
binary
get /somedir/myfile.dat
It should be reasonably straightforward to write a script that outputs an FTP script containing the correct file name.
You would think that this would be an easy task. It isn't.
The best tool I've found is SyncBack and I think there is a free/lite version available.
If you're in a Windows environment consider using PowerShell and the System.Net.WebClient .NET Framework class like this post. This is a download example, but the WebClient object also provides an UploadFile method.