Timeline for Delete .pdf files only if .xlsx files in directory have same filename?
Current License: CC BY-SA 4.0
11 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Dec 16, 2018 at 21:36 | history | edited | Rui F Ribeiro | CC BY-SA 4.0 |
deleted 6 characters in body
|
| Aug 14, 2018 at 7:49 | review | Suggested edits | |||
| Aug 14, 2018 at 8:08 | |||||
| Aug 10, 2018 at 21:28 | history | edited | choroba | CC BY-SA 4.0 |
added 66 characters in body
|
| Aug 10, 2018 at 21:28 | comment | added | choroba | Oh, you're right, I got it backwards. Silly me :-( | |
| Aug 10, 2018 at 17:51 | comment | added | Jeter-work |
Actually, I missed that his logic is inverted. Taking out the ! would fix it though. The real question is what if there's a pdf without matching xls(x). What does OP want to happen then? If they want them gone, then they need to just rm -rf *.pdf. If not, then my answer. Reading the question strictly, we're only to delete pdf files with matching xls(x) files.
|
|
| Aug 10, 2018 at 17:43 | comment | added | G-Man Says 'Reinstate Monica' |
I agree with your decision to reject the suggested edit — new answers should be posted as new answers, not edits. But I believe that Xalorous got it right and you (choroba) got it backwards. If ABCD_0000005.xlsx and ABCD_0000005.pdf both exist, your code leaves ABCD_0000005.pdf alone. But if important.pdf exists, and there’s no corresponding spreadsheet, your code deletes important.pdf.
|
|
| Aug 10, 2018 at 17:04 | comment | added | Jeter-work | It's possible that I pasted the wrong one. I'll post a separate answer with the more efficient version. | |
| Aug 10, 2018 at 17:01 | comment | added | choroba | @Xalorous: But your "alternative" removed the files my solution tried to keep. | |
| Aug 10, 2018 at 17:00 | comment | added | Jeter-work | Added slightly more efficient alternative. If this folder is extensive, it could make a difference in processing time. | |
| Aug 10, 2018 at 16:59 | review | Suggested edits | |||
| Aug 10, 2018 at 17:00 | |||||
| Aug 10, 2018 at 16:31 | history | answered | choroba | CC BY-SA 4.0 |