F
F
Forman2017-11-09 02:26:20
linux
Forman, 2017-11-09 02:26:20

How to unzip or rename an unknown folder on a Linux server?

To regularly update the file from an external server, I decided to run a wget && tar request using cron.
But after unpacking, I find that there is still a folder in the archive, the name of which is not constant (= update date).
It seems to me that there are two options:
1. Unpack a folder with an unknown name.
2. Rename folder with unknown name.
The question is how to do it? It is known that the folder in the archive is always one, and its name consists of numbers. Inside this folder are the files that you just need to get.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
F
Forman, 2017-11-09
@Forman

I solved the problem as follows:
1. Moved the file from the folder:
2. Deleted the folder with files:
Instead of *, you could use 8 times [0-9].

J
jcmvbkbc, 2017-11-09
@jcmvbkbc

It seems to me that there are two options:
1. Unpack a folder with an unknown name.
2. Rename folder with unknown name.

The third option: when unpacking the tar archive, strip one level of directories with the option --strip-components=1

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question