Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > Linux Forums > Programming/Scripts

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 18th August 2006, 21:34
karabaja karabaja is offline
Junior Member
 
Join Date: Aug 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Need some script if possible

I need some files to be copied to a different folder. I have to setup a script which downloads a file called file.zip, but the problem is that this file is extracted every time to a folder with different name. I think this file is updated weekly and and then folder in which files are extracted is for example
/file/file01082006.

Now is there a way for me to copy all files in that folder to another location. It contains like 50 txt files. I only need to copy txt files, not the folder itself.
I'd like to setup a cron which would copy these files. But I am not sure how since I can't specify a path which would change every week, even though the name of txt files is always the same.

Another thing I could use a help with is, is there some command or more of them I could use to insert two words at the very beginning and the end of those files. Like to insert "start" and "end" in each file.

One last thing is how could I rename all .txt files in a folder to .html ?

Thank you in advance, I hope my question is understandable. I am a beginner and English is not my native language.
Reply With Quote
Sponsored Links
  #2  
Old 19th August 2006, 01:05
karabaja karabaja is offline
Junior Member
 
Join Date: Aug 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Ok, you can scratch that last one out. I found a way to use them in txt form. But I need to wrap that text with <pre> tag to display it properly on the page. I can use sed to replace first word of the document they all have in common and that is not needed anyway.
But I still need a way to copy them and the way to insert </pre> at the end of each file.
Reply With Quote
  #3  
Old 19th August 2006, 01:42
karabaja karabaja is offline
Junior Member
 
Join Date: Aug 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Ok, I am narrowing it down

I found out that I could use unzip -j to so that folder structure is not recreated.

Now I need a way to insert </pre> at the end of each file.
Reply With Quote
  #4  
Old 19th August 2006, 14:32
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,711
Thanks: 1,899
Thanked 2,702 Times in 2,545 Posts
Default

Quote:
Originally Posted by karabaja
Now I need a way to insert </pre> at the end of each file.
How about
Code:
echo "</pre>" >> /path/to/file
?
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
  #5  
Old 19th August 2006, 15:09
karabaja karabaja is offline
Junior Member
 
Join Date: Aug 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
 
Default

Yes. That works, thx.
Another thing please if someone could answer. Can I have sed save output to the same file.
Like if I want to change first word of a file now I have to specify it to create output in another file.

Last edited by karabaja; 19th August 2006 at 15:26.
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Shell Script Need Help mphayesuk Programming/Scripts 4 27th June 2006 12:06
Firewall script ColdDoT Server Operation 1 8th May 2006 23:50
Script questions && Gentoo version hagel Feature Requests 4 7th May 2006 13:19
Internal Server Error 500 cgi script mphayesuk General 6 8th February 2006 22:53
DNS - call script to created named.conf entries on secondaries cstone Installation/Configuration 4 15th September 2005 01:16


All times are GMT +2. The time now is 15:54.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.