Walidix
Walidix

Reputation: 1277

Tar Error [can not open: not a directory]

I have made some archive file with the tar gnome GUI on Ubuntu but when I try to extract them

tar zxvf archive_name

I get following error

Cannot open: Not a directory

What is the problem ?

Upvotes: 4

Views: 14859

Answers (5)

sushruth murakare
sushruth murakare

Reputation: 53

This happened to me while deploying my next js project using github pages, The build was failing in the Upload artifact step. Usually while deploying nextjs project its builds a nextjs.yml file in which there would be a section Upload artifact

- name: Upload artifact
    uses: actions/upload-pages-artifact@v3
    with:
      path: ./out

By default it is set to the path ./out , you have to replace it with .next. This applies to any nextjs project

- name: Upload artifact
    uses: actions/upload-pages-artifact@v3
    with:
      path: .next

Upvotes: 0

rraj gautam
rraj gautam

Reputation: 395

You probably might already have a file with the same name that the tar is extracting a directory. Try to tar in different location.

tar zxvf tar_name.tgz --one-top-level=new_directory_name

Upvotes: 1

user5079292
user5079292

Reputation:

Try using tar -zxvf archive_name instead. I believe that the command format has changed, and it now requires the z (unzip) x (extract) v (verbose) f (filename...) parts as switches instead of plain text. The error comes from tar trying to do something to the file zxvf, which of course does not exist.

Upvotes: 0

w5m
w5m

Reputation: 2336

I encountered the same issue (for each file within an archive) and I solved it by appending ".tar.gz" to the archive filename as I'd managed to download a PECL package without a file extension:

mv pecl_http pecl_http.tar.gz

I was then able to issue the following command to extract the contents of the archive:

tar -xzf pecl_http.tar.gz

Upvotes: 1

Delan Azabani
Delan Azabani

Reputation: 81492

Try extracting the archive in an empty directory; any existing files/directories in the extract target usually cause problems if names overlap.

Upvotes: 3

Related Questions