Timeline for Delete files in a directory which are also in another directory
Current License: CC BY-SA 4.0
16 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| S May 4, 2020 at 1:48 | history | suggested | Tony | CC BY-SA 4.0 | correction |
| May 3, 2020 at 22:20 | review | Suggested edits | |||
| S May 4, 2020 at 1:48 | |||||
| Apr 13, 2017 at 12:36 | history | edited | CommunityBot | replaced http://unix.stackexchange.com/ with https://unix.stackexchange.com/ | |
| Mar 29, 2014 at 2:33 | comment | added | Ian D. Allen | @StéphaneGimenez Yes, I see now that some versions of cp take a/ to mean a/. and some don't. Ubuntu 12.04 does; CentOS 6.5 doesn't. Sigh. | |
| Mar 28, 2014 at 10:49 | comment | added | Ian D. Allen | @stéphane Assuming existing directories a and b: Saying cp -r a b means "copy the directory named a into directory b using the same name a under b", so you create b/a and put all the files under it. Saying cp -r a/ b is the same as cp -r a/. b which also means "copy the directory named a/. into directory b using the same name . under b". Of course you don't create b/. because it's already there, and so all the files go under b/. not under b/a. | |
| Jan 23, 2013 at 16:40 | comment | added | vonbrand | In such cases what I do is to send the filelist to some temporary file, say /tmp/lst, which I can check carefully (or even edit), and when I'm OK, I go rm -f $(< /tmp/lst) (the $(<is a bash(1)ism, in standard sh(1) it would be the cumbersome `rm -f `cat /tmp/lst` | |
| Aug 31, 2011 at 13:39 | history | edited | Stéphane Gimenez | CC BY-SA 3.0 | minor corrections |
| Aug 31, 2011 at 13:35 | vote | accept | nopcorn | ||
| Aug 31, 2011 at 13:31 | comment | added | Stéphane Gimenez | Yes, but this happens only with some cp versions it seems… Mine (coreutils 8.12) has not this behavior anymore. (It was useful sometimes.) | |
| Aug 31, 2011 at 13:27 | comment | added | nopcorn | The one in ./dir/? Should it have been ./dir instead? | |
| Aug 31, 2011 at 13:24 | comment | added | Stéphane Gimenez | Ah! that's cause of the final /! | |
| Aug 31, 2011 at 13:21 | history | edited | Stéphane Gimenez | CC BY-SA 3.0 | added 49 characters in body |
| Aug 31, 2011 at 13:18 | comment | added | nopcorn | No clue, I ran cp -r ./dir/ ../../ | |
| Aug 31, 2011 at 13:16 | comment | added | Stéphane Gimenez | Ah yes, I got confused by your description. Why did cp copy the content and not the directory in this case? | |
| Aug 31, 2011 at 13:11 | comment | added | nopcorn | I'm using the echo method to double check the file names first. However, I need to change dir to . or else it doesn't seem to work. Also, it only lists the files in dir, not the ones also in ../.. | |
| Aug 31, 2011 at 13:03 | history | answered | Stéphane Gimenez | CC BY-SA 3.0 |