My colleague and I have been struggling with deleting a directory and its contents.
We are working on a new version of our websites source code on Ubuntu 8.04 (dir: /var/www/websites), what we want to do is delete the websites directory and recreate it from a .tar backup we created a couple weeks ago. The purpose of this is so we can run our deployment procedure in a local environment before we do so on our live / public environment.
We use this command:
rm -r websites
This deletes the directory and the files within it.
The problem occurs when we un-tar our backup file and view the website we are getting files that don't exist in the .tar backup, in fact these files were only created a few days ago and should have been deleted.
We delete the directory once more in the manner stated above, we then create a new websites directory using the
mkdir command. Strangely at this stage the 'deleted files' do not come back, but if we unpack our .tar file the 'deleted files' appear again.
Is there a way to ensure these files are deleted, or at least the pointers that associate them with said directory.
- Our .tar backup does not include these files
- We do not want to use the shred command
- We do not want to use 3rd party applications
- Solution should be functional via terminal (SSH)
Er... we fixed it. Turns out the files that are reappearing are because of a link we have to another directory (outside the /var/www/websites), we were restoring the link but not deleting the files on the other end. D'oh!
Many thanks for your help guys... friday afternoon syndrome :-)