Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I am coding a program and at the same time, I want to share it with my group members using ubuntu. They don't have an Ubuntu One account and what I do is to publish the file and my friends just get the link and the file.

But, strangely or not, every time I upload a new version of this file (I add more code and save it), the used link seems to be "outdated" and I need to publish the same file again and to get a new link every time I modify the same file.

Couldn't it be possible to save a new version of your file and the same link just "points" to the newer version?

share|improve this question
add comment

1 Answer 1

From Chipaca's (Ubuntu One dev) answer to a similar question:

However, if you edit it with an editor that renames the file, creates a new one, copies the content in and then deletes the original (as most editors do), and syncdaemon is running, it will see the rename and the delete and your public URL will refer first to the renamed file, and then will disappear.

This is an unfortunate side-effect of the way we're doing public files, and something we need to change, but right now this is what it is.

Basically, when you save a file with most editors, you are actually replacing the original file with the modified version. You can see for yourself using the stat command:

hello@world:~$ stat -c %i hello.txt
4971

The command stat -c %i returns the inode number of a file.
Running that same command again after I have edited hello.txt in gedit
returns a different inode number:

hello@world:~$ stat -c %i hello.txt
3794

If I simply append a line of text to the end of the file using >> the file is simply modified in place, not overwritten:

hello@world:~$ echo "The End." >> hello.txt
hello@world:~$ stat -c %i hello.txt
3794

I have found a slightly awkward way to get around this limitation in Ubuntu One:

  1. Create a copy of the published file:

    cp hello.txt hello-copy.txt
    
  2. Do all of your work on the copy instead of the published file:

    gedit hello-copy.txt
    
  3. When you want to update the published file, run the following command:

    cat hello-copy.txt > hello.txt
    
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.