<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: download scripting in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/download-scripting/m-p/3128416#M8166</link>
    <description>Thanks everyone !&lt;BR /&gt;Steven and Stuart's tips are 2 100% workable solution, ready to use.&lt;BR /&gt;Jean Pierre's is also workable, except that I do not have write rights on remote server... so should it have to be turned slightly differently to take this into consideration.&lt;BR /&gt;&lt;BR /&gt;Thanks again for all this work ! I consider this thread as solved.&lt;BR /&gt;&lt;BR /&gt;I'll have another question in 10/12 days :]]&lt;BR /&gt;&lt;BR /&gt;J</description>
    <pubDate>Sat, 29 Nov 2003 03:13:11 GMT</pubDate>
    <dc:creator>Jerome Henry</dc:creator>
    <dc:date>2003-11-29T03:13:11Z</dc:date>
    <item>
      <title>download scripting</title>
      <link>https://community.hpe.com/t5/operating-system-linux/download-scripting/m-p/3128401#M8151</link>
      <description>Hi everybody,&lt;BR /&gt;&lt;BR /&gt;I'm wishing to write a script that will :&lt;BR /&gt;1. open an ftp server myserver.com&lt;BR /&gt;2. Move to a defined directory /somedir&lt;BR /&gt;3. Check if files there are different or more recents than the files I already downloaded in localhost/mydirectory from this server.&lt;BR /&gt;4. Download the new or more recent files, ignoring files older than, say 120 days.&lt;BR /&gt;5. Check in localhost/mydirectory if files here came to the 120 days dead end (files downloaded before, of course).&lt;BR /&gt;6. Delete these old files.&lt;BR /&gt;&lt;BR /&gt;Any proposition ?&lt;BR /&gt;&lt;BR /&gt;5 points for any new part, &lt;BR /&gt;2 points for an addition or improvement,&lt;BR /&gt;and of course a rabbit for the full script.&lt;BR /&gt;&lt;BR /&gt;Thanks.&lt;BR /&gt;&lt;BR /&gt;J</description>
      <pubDate>Tue, 25 Nov 2003 11:09:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/download-scripting/m-p/3128401#M8151</guid>
      <dc:creator>Jerome Henry</dc:creator>
      <dc:date>2003-11-25T11:09:43Z</dc:date>
    </item>
    <item>
      <title>Re: download scripting</title>
      <link>https://community.hpe.com/t5/operating-system-linux/download-scripting/m-p/3128402#M8152</link>
      <description>Hi J,&lt;BR /&gt;&lt;BR /&gt;I've played with something like this before.  I'd suggest writing the script in Perl and using the Net::FTP module.  It will handle all your FTP connection and file commands and it will make life much easier.&lt;BR /&gt;&lt;BR /&gt;Take a look at it here:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://search.cpan.org/~gbarr/libnet-1.17/Net/FTP.pm" target="_blank"&gt;http://search.cpan.org/~gbarr/libnet-1.17/Net/FTP.pm&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;JP&lt;BR /&gt;</description>
      <pubDate>Tue, 25 Nov 2003 14:41:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/download-scripting/m-p/3128402#M8152</guid>
      <dc:creator>John Poff</dc:creator>
      <dc:date>2003-11-25T14:41:29Z</dc:date>
    </item>
    <item>
      <title>Re: download scripting</title>
      <link>https://community.hpe.com/t5/operating-system-linux/download-scripting/m-p/3128403#M8153</link>
      <description>There's a pre-written script around called 'mirror'.  It does pretty much everything you've asked.&lt;BR /&gt;&lt;BR /&gt;Failing that, ncftpget server:/path/, and a find would do most of that for you ;)</description>
      <pubDate>Wed, 26 Nov 2003 01:35:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/download-scripting/m-p/3128403#M8153</guid>
      <dc:creator>Stuart Browne</dc:creator>
      <dc:date>2003-11-26T01:35:51Z</dc:date>
    </item>
    <item>
      <title>Re: download scripting</title>
      <link>https://community.hpe.com/t5/operating-system-linux/download-scripting/m-p/3128404#M8154</link>
      <description>rsync may help you too</description>
      <pubDate>Wed, 26 Nov 2003 02:41:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/download-scripting/m-p/3128404#M8154</guid>
      <dc:creator>Vitaly Karasik_1</dc:creator>
      <dc:date>2003-11-26T02:41:30Z</dc:date>
    </item>
    <item>
      <title>Re: download scripting</title>
      <link>https://community.hpe.com/t5/operating-system-linux/download-scripting/m-p/3128405#M8155</link>
      <description>&lt;A href="http://www.hpconsulting.com/Cleantmp" target="_blank"&gt;http://www.hpconsulting.com/Cleantmp&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;That script clears out tmp files over seven days old.  There is some interactive junk to clear out but it works great in batch mode, change the target directory for the find and the number days to deal with your 120 day requirement&lt;BR /&gt;&lt;BR /&gt;I would suggest running this script and modifying it to move eligible files to a staging directory instead of the rm command it currently uses.&lt;BR /&gt;&lt;BR /&gt;Here is the ftp part:&lt;BR /&gt;&lt;BR /&gt;ftp -v -n &amp;lt;&lt;EOF&gt;&lt;/EOF&gt;open myserver.com&lt;BR /&gt;user username password&lt;BR /&gt;cd /somedir&lt;BR /&gt;lcd localhost/mydirectory &lt;BR /&gt;put filename&lt;BR /&gt;EOF&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;A while loop can be but around the ftp command running it multiple times based on the list producted in the first script.&lt;BR /&gt;&lt;BR /&gt;The Script at the top can have a second copy run to delete the 120 day old targets.  The government might not let you clone humans, but this script likes being cloned. That covers 5 and 6.&lt;BR /&gt;&lt;BR /&gt;I just drove to STL from Chicago and my daughter won't sleep.  Given a couple of hours, I can produce you a working, tested script.  In case you are in a hurry however, my pieces will work.&lt;BR /&gt;&lt;BR /&gt;I would suggest the possiblity of using openssh to skip the ftp part and make the file transfer somewhat secure.&lt;BR /&gt;&lt;BR /&gt;Let me know if you want a finished product. When I deliver depends on factors beyond my control at this time.&lt;BR /&gt;&lt;BR /&gt;SEP</description>
      <pubDate>Wed, 26 Nov 2003 03:00:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/download-scripting/m-p/3128405#M8155</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2003-11-26T03:00:02Z</dc:date>
    </item>
    <item>
      <title>Re: download scripting</title>
      <link>https://community.hpe.com/t5/operating-system-linux/download-scripting/m-p/3128406#M8156</link>
      <description>Hey your having all the fun here !&lt;BR /&gt;&lt;BR /&gt;I have been job hunting (former company now for sale), forgot how much time this exercice required, it as keep me busy theses last few day's !, Jerome this is a good exercice for RHCE exams I will have a go at it this evening if someone else did not beat me to it .. specialy SEP ...&lt;BR /&gt;&lt;BR /&gt;but question ? you want only ftp and bash ? could we use sftp or rsync ?&lt;BR /&gt;&lt;BR /&gt;J-P&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 26 Nov 2003 06:49:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/download-scripting/m-p/3128406#M8156</guid>
      <dc:creator>Huc_1</dc:creator>
      <dc:date>2003-11-26T06:49:17Z</dc:date>
    </item>
    <item>
      <title>Re: download scripting</title>
      <link>https://community.hpe.com/t5/operating-system-linux/download-scripting/m-p/3128407#M8157</link>
      <description>wget -N ftp://username:password@some.server.com/dirtosync&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;will do the trick except:&lt;BR /&gt; - it does not ignore files on the FTP server older than 120 days&lt;BR /&gt; - it does not delete local files older than 120 days&lt;BR /&gt;&lt;BR /&gt;tmpwatch is the easy way to delete old files&lt;BR /&gt;- add in cron.daily (or monthly)&lt;BR /&gt;/usr/sbin/tmpwatch 240 /dir/to/prune&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I don't think you can retrieve files based on date without writing a FTP application.&lt;BR /&gt;&lt;BR /&gt;If you really need to get based on date I think your best bet would be to use the ncftpspooler, ncftpbatch, ncftpget suite.&lt;BR /&gt;&lt;BR /&gt;Cheers&lt;BR /&gt;Cristi</description>
      <pubDate>Wed, 26 Nov 2003 10:25:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/download-scripting/m-p/3128407#M8157</guid>
      <dc:creator>Cristian Draghici</dc:creator>
      <dc:date>2003-11-26T10:25:01Z</dc:date>
    </item>
    <item>
      <title>Re: download scripting</title>
      <link>https://community.hpe.com/t5/operating-system-linux/download-scripting/m-p/3128408#M8158</link>
      <description>why not simply use wget ? It can do FTP and has an option to only download files if they're newer than the local copies, and since it's command line you can easily include it in scripts.&lt;BR /&gt;&lt;BR /&gt;the deletion is pretty straight forward, run something like &lt;BR /&gt;find /path -mtime +120 -exec rm {} \;</description>
      <pubDate>Wed, 26 Nov 2003 10:25:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/download-scripting/m-p/3128408#M8158</guid>
      <dc:creator>Patrick Van Humbeeck</dc:creator>
      <dc:date>2003-11-26T10:25:55Z</dc:date>
    </item>
    <item>
      <title>Re: download scripting</title>
      <link>https://community.hpe.com/t5/operating-system-linux/download-scripting/m-p/3128409#M8159</link>
      <description>hpuxconsulting.com is whacked again&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www.hpux.ws/Cleantmp" target="_blank"&gt;http://www.hpux.ws/Cleantmp&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Is up so try that one.&lt;BR /&gt;&lt;BR /&gt;I'm solo on Parent patrol so it will be a while before I can try that script.&lt;BR /&gt;&lt;BR /&gt;SEP</description>
      <pubDate>Wed, 26 Nov 2003 11:13:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/download-scripting/m-p/3128409#M8159</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2003-11-26T11:13:31Z</dc:date>
    </item>
    <item>
      <title>Re: download scripting</title>
      <link>https://community.hpe.com/t5/operating-system-linux/download-scripting/m-p/3128410#M8160</link>
      <description>I'm back !&lt;BR /&gt;&lt;BR /&gt;Benn traveling to attend Computer security fair in Paris. Fun to see that many vendors know their product so well and security so bad ! Is it the same in USA ?&lt;BR /&gt;&lt;BR /&gt;Back to the point. Thanks everyone for working on my prob.&lt;BR /&gt;&lt;BR /&gt;John, thanks for the idea. But I must confess I'm a perl dummy. I know how to use a program, but am very weak at wrtting any change on it... unless it's done for me :]] But why not, with a few help...&lt;BR /&gt;&lt;BR /&gt;Stuart, I've heard about mirror program, but can't find it back : do you have any pointer ?&lt;BR /&gt;&lt;BR /&gt;Vitaly, thanks for rsync idea, but the trouble is that I do not want to re-download the full directory, as I'm throwing away old programs, which the original directory doesn't...&lt;BR /&gt;&lt;BR /&gt;Steven, Thanks for the link, I got it from hpux.ws. I'll try it tommorrow (late here...) and tell you who it turns to bash (it's ksh, but doesn't seem to be too sepcific :] )&lt;BR /&gt;&lt;BR /&gt;Christian, yes, that's the issue, not redownloading what I will delete anyway...&lt;BR /&gt;&lt;BR /&gt;Patrick, you may have it ! Looking at the scripts you suggest seems to be a workable solution : once again, 'll try it tommorrow !&lt;BR /&gt;&lt;BR /&gt;Jean Pierre, as an RHCE, why not suggest something on rsync and find, even incomplete ?&lt;BR /&gt;&lt;BR /&gt;I'll assign points too tommorrow : any last suggestion ?&lt;BR /&gt;&lt;BR /&gt;Thanks a lot anyway !&lt;BR /&gt;&lt;BR /&gt;J&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 27 Nov 2003 16:42:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/download-scripting/m-p/3128410#M8160</guid>
      <dc:creator>Jerome Henry</dc:creator>
      <dc:date>2003-11-27T16:42:51Z</dc:date>
    </item>
    <item>
      <title>Re: download scripting</title>
      <link>https://community.hpe.com/t5/operating-system-linux/download-scripting/m-p/3128411#M8161</link>
      <description>RSync isn't nice enough to deal with files of any given age.  A URL for the mirror perl script though:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="ftp://ftp.cs.columbia.edu/archives/perl/mirror/" target="_blank"&gt;ftp://ftp.cs.columbia.edu/archives/perl/mirror/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;It has the ability to delete files older than 'max_days' of age.&lt;BR /&gt;&lt;BR /&gt;I'm not sure if it will also delete local files (I think it will).&lt;BR /&gt;&lt;BR /&gt;It's old, circa 2000, but it was a fantastic tool then, and is a good one for the war-chest.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 27 Nov 2003 18:16:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/download-scripting/m-p/3128411#M8161</guid>
      <dc:creator>Stuart Browne</dc:creator>
      <dc:date>2003-11-27T18:16:20Z</dc:date>
    </item>
    <item>
      <title>Re: download scripting</title>
      <link>https://community.hpe.com/t5/operating-system-linux/download-scripting/m-p/3128412#M8162</link>
      <description>Sorry for late reply but, I have been busy lately&lt;BR /&gt;What I had in mind is something like the following&lt;BR /&gt;&lt;BR /&gt;I first would delete old from remote structure as your question made me think you had delete rights on remote directory !&lt;BR /&gt;&lt;BR /&gt;then rsync remote to local&lt;BR /&gt;&lt;BR /&gt;then clean old on local&lt;BR /&gt;&lt;BR /&gt;Something like this&lt;BR /&gt;&lt;BR /&gt;ssh JeromeHenry@myserver.com 'find /somedir -mtime +120 -exec rm {} \;'&lt;BR /&gt;rsync -avz -e ssh myserver.com/somedir /mydirectory&lt;BR /&gt;find /mydirectory -mtime +120 -exec rm {} \;&lt;BR /&gt;&lt;BR /&gt; &lt;BR /&gt;a very busy, but having some positive replies&lt;BR /&gt;&lt;BR /&gt;J-P</description>
      <pubDate>Fri, 28 Nov 2003 03:59:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/download-scripting/m-p/3128412#M8162</guid>
      <dc:creator>Huc_1</dc:creator>
      <dc:date>2003-11-28T03:59:18Z</dc:date>
    </item>
    <item>
      <title>Re: download scripting</title>
      <link>https://community.hpe.com/t5/operating-system-linux/download-scripting/m-p/3128413#M8163</link>
      <description>Please remplace &lt;BR /&gt;rsync -avz -e ssh myserver.com/somedir /mydirectory&lt;BR /&gt;&lt;BR /&gt;with&lt;BR /&gt;&lt;BR /&gt;rsync -avz -e ssh JeromeHenry@myserver.com:/somedir /mydirectory&lt;BR /&gt;&lt;BR /&gt;forgot the ":" &lt;BR /&gt;&lt;BR /&gt;I ssh is setup right pn source and target it does not ask for password.&lt;BR /&gt;&lt;BR /&gt;J-P (0 pts for this mea-culpa and add on)&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 28 Nov 2003 10:41:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/download-scripting/m-p/3128413#M8163</guid>
      <dc:creator>Huc_1</dc:creator>
      <dc:date>2003-11-28T10:41:22Z</dc:date>
    </item>
    <item>
      <title>Re: download scripting</title>
      <link>https://community.hpe.com/t5/operating-system-linux/download-scripting/m-p/3128414#M8164</link>
      <description>here, some ftp functions ( 1 for ssh/scp, the other for standard ftp ) written in bash.&lt;BR /&gt;&lt;BR /&gt;just source the file within another script and the functions will be available in your script.&lt;BR /&gt;</description>
      <pubDate>Fri, 28 Nov 2003 12:44:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/download-scripting/m-p/3128414#M8164</guid>
      <dc:creator>Olivier Drouin</dc:creator>
      <dc:date>2003-11-28T12:44:49Z</dc:date>
    </item>
    <item>
      <title>Re: download scripting</title>
      <link>https://community.hpe.com/t5/operating-system-linux/download-scripting/m-p/3128415#M8165</link>
      <description>Like Huc said you can add the public key of a user on a server to your ~/.ssh/known_hosts on another server and ssh will not bother you with passwd.</description>
      <pubDate>Fri, 28 Nov 2003 12:56:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/download-scripting/m-p/3128415#M8165</guid>
      <dc:creator>Olivier Drouin</dc:creator>
      <dc:date>2003-11-28T12:56:57Z</dc:date>
    </item>
    <item>
      <title>Re: download scripting</title>
      <link>https://community.hpe.com/t5/operating-system-linux/download-scripting/m-p/3128416#M8166</link>
      <description>Thanks everyone !&lt;BR /&gt;Steven and Stuart's tips are 2 100% workable solution, ready to use.&lt;BR /&gt;Jean Pierre's is also workable, except that I do not have write rights on remote server... so should it have to be turned slightly differently to take this into consideration.&lt;BR /&gt;&lt;BR /&gt;Thanks again for all this work ! I consider this thread as solved.&lt;BR /&gt;&lt;BR /&gt;I'll have another question in 10/12 days :]]&lt;BR /&gt;&lt;BR /&gt;J</description>
      <pubDate>Sat, 29 Nov 2003 03:13:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/download-scripting/m-p/3128416#M8166</guid>
      <dc:creator>Jerome Henry</dc:creator>
      <dc:date>2003-11-29T03:13:11Z</dc:date>
    </item>
    <item>
      <title>Re: download scripting</title>
      <link>https://community.hpe.com/t5/operating-system-linux/download-scripting/m-p/3128417#M8167</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Slight modification in find script :&lt;BR /&gt;find /path -ctime +120 -exec rm -f {} \;&lt;BR /&gt;I prefer -ctime to search for creation date instead of modification, then use -f not to be asked at each line if I'm sure to remove this file, and space is required between {} and ;&lt;BR /&gt;&lt;BR /&gt;Thanks again !&lt;BR /&gt;&lt;BR /&gt;J</description>
      <pubDate>Sat, 29 Nov 2003 07:29:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/download-scripting/m-p/3128417#M8167</guid>
      <dc:creator>Jerome Henry</dc:creator>
      <dc:date>2003-11-29T07:29:51Z</dc:date>
    </item>
  </channel>
</rss>

