Jump to content


p4 command for last access to workspace

Workspace access date

  • Please log in to reply
4 replies to this topic

#1 ITSupport-ORTEC

ITSupport-ORTEC

    Newbie

  • Members
  • Pip
  • 9 posts

Posted 07 January 2019 - 04:14 PM

Hi,

I have searched and have not found a command that returns all workspaces owned by certain user that have been accessed in 2018.
I use two commands I use in Windows:
  • p4 clients -u <user>, this tells me which workspaces are owned by an user. I use the outcome for the next command
  • p4 client -o | findstr/b "Access:", this tells me when the workspaces owned by the user were last accessed.

How can I combine both commands that returns the names of the workspaces owned by user X, with a last accessed date before 2018, or 2017, or any particular date?

Thanks in advance.

ITSupport-ORTEC,

#2 Sambwise

Sambwise

    Advanced Member

  • Members
  • PipPipPip
  • 800 posts

Posted 07 January 2019 - 09:05 PM

Something like:

p4 -Ztag -F "%Client% %Access%" clients -u <user>

ought to get you most of the way there.  (If that doesn't get you anything, leave off the -F "..." part so you can take a look at what the valid field names are and tweak the format string accordingly -- I don't have p4 installed on this machine so can't check easily.)

You can then pipe that into a sort command to sort them by access date, and that should make it easy to cut them off at an arbitrary point.

#3 ITSupport-ORTEC

ITSupport-ORTEC

    Newbie

  • Members
  • Pip
  • 9 posts

Posted 09 January 2019 - 03:22 PM

Hi Sambwise,

Thanks. Your command works. There is however one thing that I don't understand, which is the Access "date".
I get these kinds of Access "dates":  1519482034.
Do you know how to convert these to actual dates or to get the dates from Perforce using your command?

Thanks in advance.

#4 Sambwise

Sambwise

    Advanced Member

  • Members
  • PipPipPip
  • 800 posts

Posted 09 January 2019 - 03:30 PM

Those are Unix timestamps (seconds since the 1970 epoch).  It's pretty simple to convert these to human-readable dates: https://stackoverflo...o-a-date-string

#5 ITSupport-ORTEC

ITSupport-ORTEC

    Newbie

  • Members
  • Pip
  • 9 posts

Posted 10 January 2019 - 10:11 AM

Hi Sambwise,

You live up to the last part of your account name. Wise..... :) . Thanks to you I have all the information I need.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users