How to find the view location in my linux home dir

2019-05-25 14:51发布

问题:

I have many views in my Linux home dir under different folders mentioned below.

Home 
  CCVIEWS
  views
  Development
  testproject
  :
  :
  etc.

Now i want to list all the clearcase views in my linux dir in below format to work on other script.

user_test_Work1.vws
user_test_Work2.vws
user_dev_Work1.vws
user_newproject_Work.vws
user_cqfix.vws 

How to search all the views in my home directory created by me and display the list of the views in shell script?

Current at a time I can display one folder views but I need to search and display all the views in the above format.

My views are dynamic views only not snapshot . My issue was with views stored in multiple directories . Need to search all the views in my unix home dir . Now i am using commands cd ~/views ViewCount=ls ~/views to do the job . But this will list the views in one dir . In same way i need to list all the views in my home dir in all directories .Is there any way to search all views and list views

回答1:

If those views aren't under /view, that means there are snapshot views.
(Not web views, since cleartool is mentioned, which means no CCRC)

And as mentioned in "Find local copy of files in snapshot view", you cannot find a snapshot view from its tag alone.
That means a simple cleartool lsview -l with some grep won't select only your views from your home directory.
It would select your views, wherever you chose to load them.

user_cqfix.vws is a view workspace storage.

The simplest solution would be to go to each of your HOME immediate sub-directories, and do a cleartool lsview -l -cview command.
The owner (line "View owner: ...") of the view and the view storage path (line "Global path: ...") will be listed in the output of the cleartool command.

Note, that assume that your views are loaded directly under your HOME.
If they at a greater depth than a direct sub-directory, then you need to repeat that process recursively for all directories within your HOME.

Finally, this makes sense if you need to associate a view storage path (*.vws) with the path where your snapshot view is loaded (since ClearCase won't be able to tell you where the root directory of a snapshot view is).

If you don't need the root directory path, then a simple cleartool lsview -l would list all views, with you able to select the ones you want.

Look also at "About snapshot view storage directories": if all your views are using the same view storage server, then you could simply infer the view storage path by knowing its common root shared path.


Note, regarding finding "snapshot view" root directories, this thread mentions:

ClearCase does not provide a good built-in method for identifying the root working directory of a snapshot view. That information is stored in a user profile.
On Windows, snapshot views are only recognized by ClearCase on the host where they were created. This is because the working directory information is stored locally in the user profile (registry) on the machine where the view was created.
If you are interested in a specific user's snapshot views, look in the registry using:

\HKEY_USERS\<SID>\Software\Atria\ClearCase\CurrentVersion\Workspaces 

where <SID> is the text-based Security Identifier for the given user.
With the proper administrative access, this information is accessible by connecting to a remote registry as well. Typically though, there is only one user per PC, and to find snapshot view directories for the current user, you would just use:

\HKEY_CURRENT_USER\Software\Atria\ClearCase\CurrentVersion\Workspaces 

If you change directories to the directories listed there, you could use 'cleartool lsview -cview' to find which view it was.

On UNIX, the user profile information is stored in ~/.ccase_svreg, and since home directories are typically shared (automounted on many clients), the snapshot view is useable (in the ClearCase sense) on any ClearCase client that has access to the working directory.

That being said, remember you can replicate multiple times a snapshot view (simply copy the hidden file view.dat found at the root directory of a snapshot view in any other directory, and presto: that snapshot view now exists in two different places!