December 19, 2019

Bash loop through files and FTP them

I have an envelope of csv records that need transferring to a server I would prefer not to do it physically, Bash can deal with this assignment consummately.

This content will interface with a FTP server at that point circle through the csv records or any sort indicated and transfer them. You can’t do a circle while within heredoc square like most models do, rather the directions are kept in touch with a txt document.

First arrangement of factors are the ftp association bash loop subtleties and the kind of document to search for, possibly required when searching for particular sorts of records for this situation .csv records.

Each direction finishes in ¬Ľ ftp.txt this keep in touch with the document called ftp.txt if the record doesn’t exist it’s made.

When associated do an album (change registry) do go to the predetermined catalog.

To circle through the records a ‘for filename in’ is utilized go in the sort variable the * is a special case to choose all coordinating.

to execute the code put away inside the txt document use ftp < ftp.txt utilize the – in banner to stop the brief for a secret key.

In conclusion erase the ftp.txt record.

For as long as 12 years, I’ve been creating applications for the web utilizing generally PHP. I do this professionally and love what I do as consistently there is something new and energizing to learn.

In my extra time, the web advancement network is a major piece of my life. In the case of overseeing web based programming gatherings and websites or going to a meeting, I discover keeping included encourages me keep awake to date. This is additionally my opportunity to offer back to the network that helped me begin, a spot I am pleased to be separated of.

Other than programming I love investing energy with loved ones and can regularly be discovered together going out getting the most recent motion picture, remaining in messing around on the couch or arranging an outing to somewhere I’ve never been.

My Blog 0 Replies to “Bash loop through files and FTP them”