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?


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

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

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

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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