LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-24-2011, 09:51 AM   #1
Howey
LQ Newbie
 
Registered: Aug 2011
Posts: 8

Rep: Reputation: Disabled
How to update a certain file or two


Okay, so what I have right now is I upload my files, it unzips them, everything works fine.

What I'm having trouble with is how to upload a zip file (Which is the same name as a directory), and the contents inside the zip file replaces the contents on the server that has the same name.format and keeps all the other files the same.

For example:

http://www.linuxquestions.org/questi...1&d=1316872244

I can provide the uploading code if need be (Using PHP to upload the files in the first place).
Attached Thumbnails
Click image for larger version

Name:	help.png
Views:	18
Size:	33.9 KB
ID:	8050  
 
Old 09-24-2011, 10:57 AM   #2
jdkaye
LQ Guru
 
Registered: Dec 2008
Location: Westgate-on-Sea, Kent, UK
Distribution: Debian Testing Amd64
Posts: 5,464

Rep: Reputation: Disabled
Hi Howey,
Your question is very unclear so it's very hard to answer you. What are you trying to upload? Where are you trying to upload it to? A zip file is like any other file with respect to uploading and downloading. What is different is what you do with it. If you are uploading it then the person you're uploading it to is the one who will unzip it. Is this what you mean?
ciao,
jdk
 
Old 09-24-2011, 11:13 AM   #3
Howey
LQ Newbie
 
Registered: Aug 2011
Posts: 8

Original Poster
Rep: Reputation: Disabled
Okay, let me attempt to explain again, sorry for the confusion.

In steps:

1. User uploads a game to their directory (/home/user/hostgames)

(The file is called solarconquest.zip)

2. It automatically unzips for them and creates a folder and the files from the zip file are added (/home/user/hostgames/solarconquest)

(The .dmb and .rsc are the main game files)

3. They run their game, player savefiles are created, etc and everything going good.

4. They update their game and need to upload the new files.

5. They upload their new .zip file called solarconquest.zip (again)

6. It automatically unzips.

-------------------

Now what I want to happen after:

1. The old .dmb and .rsc are deleted (everything else like player files etc are kept)

2. The new .dmb and .rsc (which was in the recently uploaded zip file) are added in place.


-----------------

What actually happens after:

1. All files (including the player files) are deleted and there is only the newly uploaded files.


-------------------------------------------




Hopefully that will help explain what I want lol.
 
Old 09-24-2011, 02:33 PM   #4
jdkaye
LQ Guru
 
Registered: Dec 2008
Location: Westgate-on-Sea, Kent, UK
Distribution: Debian Testing Amd64
Posts: 5,464

Rep: Reputation: Disabled
Please look up the definitions of "upload" and "download". Do you really mean?
Quote:
User uploads a game to their directory (/home/user/hostgames)
or do you mean "downloads" in this case. You upload from your computer to somewhere else on the web (e.g. Google - "I uploaded my contact list to google"). You download from somewhere to your computer. Using these terms correctly will greatly increase the chances of a helpful answer.
ciao,
jdk
 
Old 09-24-2011, 03:35 PM   #5
Howey
LQ Newbie
 
Registered: Aug 2011
Posts: 8

Original Poster
Rep: Reputation: Disabled
Oh my bad, change upload to download :O Sorry, but I still have the problem. :/
 
Old 09-25-2011, 12:50 AM   #6
jdkaye
LQ Guru
 
Registered: Dec 2008
Location: Westgate-on-Sea, Kent, UK
Distribution: Debian Testing Amd64
Posts: 5,464

Rep: Reputation: Disabled
Before you upgrade the game why not rename /home/user/hostgames/solarconquest as /home/user/hostgames/solarconquest.old. Delete the .dmb and .rsc files from this folder. Now you can do your upgrade. Next delete all the files in the new .../solarconquest folder except for the .dmb and .rsc files. Now copy all the files from .../solarconquest.old to .../solarconquest.
Got it?
ciao,
jdk
 
Old 09-25-2011, 01:04 AM   #7
Howey
LQ Newbie
 
Registered: Aug 2011
Posts: 8

Original Poster
Rep: Reputation: Disabled
Can't think of how I would write that in PHP using the exec() function.
 
Old 09-25-2011, 01:54 AM   #8
jdkaye
LQ Guru
 
Registered: Dec 2008
Location: Westgate-on-Sea, Kent, UK
Distribution: Debian Testing Amd64
Posts: 5,464

Rep: Reputation: Disabled
I don't write PHP code so I can't help you there but I'm sure it's doable. Doesn't PHP provide the means to delete, rename, copy, ... things like that? I'd be surprised if it didn't.
ciao,
jdk
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] how to update a file with some configuration changes. sysmicuser Linux - Newbie 16 06-22-2011 09:55 AM
no hdlist file on update cd nouvellebie Mandriva 5 08-15-2006 09:16 AM
How to read variable from one file & update its value in another file minil Programming 1 03-22-2005 01:12 AM
Yum Update complains of missing file to do update, but file exists! davidas Linux - Newbie 0 03-28-2004 12:14 PM
Yum update complains missing file (broken dep), but file can be located. davidas Linux - Software 0 03-27-2004 10:11 PM


All times are GMT -5. The time now is 04:01 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration