0

I am trying to find a way how to locate a certain folder.

Problem is that I don't know exact folder name in given time.

So I am looking to find a folder based on regex, based on date, for example in 17.50 that day or the moment when application finish. [see example below]

/application/qa/log/r52d4/20201020/20201020-17.59.49_r52d4_testuser

So with putty I am trying to connect to server and locate that folder name and save that folder name in a txt file for later usage.

pscp find / -type d -name 'r52d4' -P 22 -pw test_pw testuser@testserver:/ C:\saved_logs\folder_name.txt

My question is if this is the correct approach for solving this issue, and if you guys can point me in the right direction.

Note: I don't need help with finding correct date, just correct approach.

Edit:

So far came with this, google searches didn't help me, I am not sure if I have to first login with pscp and then execute find method or everything needs to be combined:

pscp -P 22 -pw test_pw testuser@testserver find . -type d -regextype sed -regex ".*/20201020-17\.5[0-9]\.[0-5][0-9]_r52d4.*"
whatismyname123
  • 149
  • 1
  • 13

1 Answers1

2

You can use this command (from 17:50:00 to 17:59:59):

$ find . -type d -regextype sed -regex ".*/20201020-17\.5[0-9]\.[0-5][0-9]_r52d4.*"

Or this if you want only from 17:50:00 to 17:50:59

$ find . -type d -regextype sed -regex ".*/20201020-17\.50\.[0-5][0-9]_r52d4.*"
xanhacks
  • 122
  • 2
  • 5
  • What bothers me is how to write command that connects to the server using pscp and then executes find method. How to combine these two ? See my edit. – whatismyname123 Oct 22 '20 at 11:30