
18th August 2006, 22:34
|
|
Junior Member
|
|
Join Date: Aug 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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.
|

19th August 2006, 02:05
|
|
Junior Member
|
|
Join Date: Aug 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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.
|

19th August 2006, 02:42
|
|
Junior Member
|
|
Join Date: Aug 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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.
|

19th August 2006, 15:32
|
|
Super Moderator
|
|
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 31,843
Thanks: 781
Thanked 1,557 Times in 1,476 Posts
|
|
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
?
|

19th August 2006, 16:09
|
|
Junior Member
|
|
Join Date: Aug 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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 16:26.
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT +2. The time now is 11:49.
|
Recent comments
3 hours 17 min ago
8 hours 33 min ago
8 hours 44 min ago
8 hours 52 min ago
9 hours 54 min ago
12 hours 1 min ago
14 hours 27 min ago
14 hours 45 min ago
14 hours 53 min ago
16 hours 9 min ago