13991010
13991011
13991012
13991013
Fabric
Test
Test2
I want to mirror only content of latest directory with this pattern 13991013 (8digit)
Content of each directory like this : 13991013 > customers1 customers2 customers3
e.g.
something like this:
Sorry, I can't understand the question. In the above examples with pattern '[0-9]' ,
the largest eight-digit integer or the pattern itself (if no matches are found) will be displayed in the "$_" variable
try this
Hello
Please do not quote everything meaninglessly. This makes it difficult to work with your topic.
The main task was to find the last directory either by number or by creation time.
I still haven't received an answer, we have dealt with the main task or not and which option is right for you.
Just in case, I bring a few and I hope for your detailed answers
and?
did we solve your problem?
If not, then specifically on the code above, write what does not work.
I tried to divide the problem into its component parts. In the first, you need to find the desired directory.
Forget about its contents for now. Write which of the given examples finds the correct directory.
ls -pt | grep -Em1 '[0-9]{8}/$'
ls -pt | grep -m1 '[0-9]*/$'
Or maybe you have access via the SSH protocol? For example, by public key
REMOTE_DIR="$REMOTE_DIR/$(ssh user@host "cd $REMOTE_DIR; ls -tp | grep -Em1 '[0-9]{8}/$'")"
--- Post updated at 16:00 ---
Another option. If there is any sequence in the numbering of remote directories, for example,
the number in the name increases by one every day. You can simply organize a daily increase number in the local script