cp -r is copying over files that don't exist

1

I'm trying to copy the contents of one directory to another using:

cp -r ~/dev/testing/app/ ~/dev/app/

It works, but it's copying over files that don't exist (at least visually).

For instance index.php is not in /dev/testing/app/, but when I do cp -r ~/dev/testing/app/ ~/dev/app/ then index.php appears in the /dev/app/ directory.

I may have had index.php in /dev/testing/app/ at one point, but I've since deleted it. Why is it still copying over to the /dev/app/ directory?

evan

Posted 2015-11-15T19:38:53.020

Reputation: 123

Does another application still have the file open? On Unix systems, deleted files aren't physically removed from the system unless and until no applications have the file open and there are no references on the filesystem such as hard links referring to it. http://stackoverflow.com/questions/5219896/how-do-the-unix-commands-mv-and-rm-work-with-open-files

– bwDraco – 2015-11-15T20:08:14.023

@bwDraco that is true, in the literal sense that the data of an unlinked but open file can still be there, but the removed directory entry for a recursive cp to find it will not be there, so it does not seem to apply. – Chris Stratton – 2015-11-15T20:15:24.330

If he is copying from a remote system, e.g., over NFS mount, the server may still have the name in the cache as long as something has the file open. – Thomas Dickey – 2015-11-15T21:18:29.727

I'm on a mac, I don't have the previous files open. – evan – 2015-11-17T15:44:58.210

I'm just doing it locally from one folder to another – evan – 2015-11-17T15:45:13.990

No answers