0

I have a couple of tar archives, among them, some have the same filename as folders:

folderA
folderA.tar
folderB.tar
...

I want to be able to list/find all the tar files (ideally on the same/current folder) that don't already exist as folders (as in, folders with same names as tar archives).

In the above example, only folderB.tar would the only one showed.

How can i do the above using Bash/Unix tools? (ideally without using more than once instance of find/find-like utilities)

1 Answer 1

2

pure bash:

for line in *.tar;do [ -d "${line%.tar}" ] || echo $line;done

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .