I googled for this kind of function but didn't find anything. I have an FTP connection with a server, went to the dir. In this dir there are several TXT files. I would like to have function that downloads all this files, based on their .txt extension.
or the real file (little bit modified, for security reasons)
In the same folder there are some other files named *IP*_folderlist. Where the first part is the IP address like xxx.xxx.xxx.xxx. These files contain the folders
The content of this files looks like this:
So what has to happen: a loop has to run through the ftpservers.txt and check if there is an IP_folderlist.txt in the currect dir, for the checked IP. If so it has to get them and put them in an array. After that, it should go to the 2nd line which is the $user, the 3rd line is the $passwd. If there is no IP_folderlist.txt, it has to skip to the next IP address line in the ftpserver.txt file, and check again, etc...
This is the bash script I made with the kind help of Franklin, indeed.
Although this could not really supply all the functionality we need, and no one here is really familiar with bash so in the end we choose to switch to PHP. I have to admit it programs better and there are lots of (build-in) functions available. Also the information on the internet is wider etc.
This is what I have so far, this downloads files from another server, and it works. Now I have to download other files, those specified in the IP_folderlists, I wrote about.
I would like to have a funtion, in PHP, that does te same as:
It checks every time the first line for an IP, and when it finds a folderlist, it jumps to that file and reads it out.
in PHP, you can use file_get_contents() , fread() , fopen() to read files. Since you are more familiar with PHP, you can go to the manual to see examples of how to iterate a file.
There are files in a directory and I have to move multiple files adding datetimestamp before the file type.
/Data/
abc.csv
def.csv
ghi.csv
I have to move this files to archive directory adding datatimestamp before .csv
/archive/
abc_YYYYMMDDHHMMSS.csv
def_YYYYMMDDHHMMSS.csv... (7 Replies)
Hi,
I'm working on a script which has to copy multiple files from one server to another server. The list of files that are to be copied is present in a file say input.txt.
vi input.txt
abc.c
welcome.c
new.c
welcome1.c
for ftp'ing a single file say 'new.c' the following code... (2 Replies)
Hi,
Seems like I need help again with a problem:
I want to delete all files from my lets say "Music" Directory inkluding all of the subfolders
except for .mp3 and .MP3 files.
I tried it with globalignoring mp3 files, finding and deleting all other files, which
resulted in all files... (3 Replies)
I want a script that will add comments to a file before check-in files. comments depend on type of files.
i have a script to list files in the directory that will be checked-in
There are xml, js, html, vm files. vm will use comments like c/c++ ( // or /*..*/)
can you help me add a comment line... (0 Replies)
Hello, I am having trouble getting the type command to work in PHP whereas it works fine on the command line with only certain functions... example from PHP script: echo system('type cp'); returns cp is /bin/cp whereas echo system('type mogrify'); returns nothing... whereas from the unix... (1 Reply)
Hi there
I want to create a batch file which Get (mget) the newly added Files only from specific directory on UNIX server to specific folder on windows server using FTP, and this batch file will be scheduled on the windows server to run daily to load the new files (load the newly added files... (1 Reply)
Hi there
I want to create a batch file which Get (mget) the newly added Files only, from specific directory on UNIX server to local folder on windows server through FTP, and this batch file will be scheduled to run daily to load the new files.
help me plz :confused: (1 Reply)
I am currently in FTP.
I want to transfer two files and need the out put in One file.
Can you help me....
For eg: if i am doing mget from 1 server to other. (1 Reply)