I need a perl script using I can copy a versioned file (using extended path) to a directory .
the simple copy command here does not working.
here the versioned files
K:\views\jah\hakgs\sr\th\test.java##\main\branch\view\1
K:\views\jah\hakgs\sr\th\test.java##\main\branch\view\2
K:\views\jah\hakgs\sr\th\test.java##\main\branch\view\3
I want these files copy and stored outside the view to a directory.like the first versionned file must store in folder name 1,second file in folder 2,3rd file in 3.
Is it possible to do with a perl script.
Please give any suggestion.Many thanks in advance
The problem is:
if the simple copy does not work, the script Perl won't either.
I suppose K:\views\jah... refers to a snapshot view.
I would recommend first to create a dynamic view and try the same extended path (I assume hakgs is a VOB):
copy M:\jah_views\hakgs\sr\th\test.java##\main\branch\view\1 \path\to\your\Directory1
If it works, then you can encapsulate it in a script Perl using my ClearCase Perl Package.
The easiest way how to copy files is using dynamic view where you simply specify version numbers:
copy "K:\views\jah\hakgs\sr\th\test.java##\main\branch\view\1" "1\test.java"
copy "K:\views\jah\hakgs\sr\th\test.java##\main\branch\view\2" "2\test.java"
copy "K:\views\jah\hakgs\sr\th\test.java##\main\branch\view\3" "3\test.java"
If you are using snapshot view, you need to use following commands (it work also for dynamic view):
cleartool get -to "1\test.java" "K:\views\jah\hakgs\sr\th\test.java##\main\branch\view\1"
cleartool get -to "2\test.java" "K:\views\jah\hakgs\sr\th\test.java##\main\branch\view\2"
cleartool get -to "3\test.java" "K:\views\jah\hakgs\sr\th\test.java##\main\branch\view\3"
Related
I have to read a file in my shell script. I was using PL/SQL's UTL_FILE to open the file.
But I have to do a new change which will append timestamp to the file.
e.g import.data file becomes import_20152005101200.data
Now timestamp is the time at which file arrive at the server.
Since the file name changed I can't use the old way of file accessing.
I came up with below solution:
UTL_FILE.FOPEN ('path','import_${file_date}.data','r');
To achieve this I have to get filename and trim it using SUBSTR to get timestamp and pass to file_date variable.
However I am not able to find how to access filename in a particular path. I can use basename. But My file name keeps changing because of timestamp.
Any help/ alternate ideas are welcome.
PL/SQL isn't a good tool to solve this problem; UTL_FILE doesn't have any tools to list all the files in a folder.
A better solution is to define a stored procedure which uses UTL_FILE and pass the file name to process as an argument to the procedure. That way, you use the shell (which has many powerful commands and tools to examine folders and files) or a script language like Python to determine which file to process.
I need to create a batch script that will only copy files with a certain part of the file name
Example I need to copy a file with * _*_2006 in its name
12345_12_2006_12345678.dcm
But I do not want to copy any files like the below examples
12345_13_2007_123452006.dcm
or
21355_10_2008_200654321.dcm
*_ * _2006*.dcm will not work
You will notice that in the two examples that I do not want to copy 2006 is also there but in a different location in the file name.
*_ *_2006_*.dcm
should work so it should
Edit: or to be more restrictive:
?????_??_2006_*.dcm
This should work:
*_2006_*.dcm
In my current working environment, I make use of eclipsed files extensively for testing purposes. When it comes time to formalize things, I have a script which generates a diff by comparing the file with a backup saved by my eclipse script.
I'd like to be able to work without the backup of the original file; is there any way I can retrieve the current version of the file that I can pass to diff? Even though the file is view-private, I see I can enter foo##/ and see a list of versions, but I'm not sure how to find which version is the latest. Everything I've tried using cleartool ls or describe with the file name tells me that it's not a VOB object (which is true, although cleartool ls does show it as eclipsed, so it must know, somehow, that there is an element there)
Thanks
Eclipsed file means dynamic view.
The simplest solution would to make a second dynamic view based on the same config spec.
Considering how cheap and quick those views are, this isn't an issue.
On that second dynamic view, you can do a
cleartool descr -fmt "%Xn" /path/to/element
In order to get the extended pathname of the file (see fmt_ccase for more on the %Xn syntax).
I am trying to use a MEL script to load ANIMATION.MA file that references CHARACTER_RIG.MA. The CHARACTER_RIG.MA and ANIMATION.MA files are produced by someone else and supplied to me. The ANIMATION.MA is looking for N:/Project/Maya//char/character/CHARACTER_RIG.MA
If I open ANIMATION.MA from Maya, or use the equivalent MEL command I always get prompted with:
"Reference File Not Found"
Reference File Not Found: N:/Project/Maya//char/character/CHARACTER_RIG.MA.
[Abort File Read] [Skip] [Browse...] [Retry]
If I tap browse, and select the CHARACTER_RIG.MA then it opens perfectly. I can see it created a reference in the Reference Editor that has the Unresolved Path (N:/...) , the Resolved Path (/my/path) and the namespace and the namespaceRN.
My question is, how do I do the equivalent of the "Browse..." from MEL? I tried pre-creating a reference, but it doesn't let me set the unresolved path, so when I load the ANIMATION.MA it keeps prompting in MAYA.
file -f -options "v=0" -typ "mayaAscii" -o "/Source/project/assets/anims/ANIMATION.MA"
If you know the directory where the file is, then you can use the dirmap command. The command dirmap allows you to remap directory structures if your disk configuration changes. So in this case it would look like:
dirmap -en true;
dirmap -m "N:/Project/Maya//char/character" "/my/path";
Possibly more manageable if you have lots of mappings to do especially when moving form a windows machine to a *nix one. However it is much more useful to define your project structure because then things just work when you move, tough this may not be the best of choice for shared assets.
I ended up finding several solutions:
Rename the RIG.MA file to match the filename in ANIM.MA (they were different in my case) and put it in one of the search or project folders that MAYA uses and it will automatically find it.
or
Programatically through code (or manually) edit the ANIM.MA file to remap the file/folder of the RIG.MA to where you want to load it from. Note: You
also need to remap any other files, such as textures. I did this with
perl -pi -e 's/\Qold-path\E/\Qnew-path\E/g' ANIMATION.MA
HTH someone else.
Quick and easy, File, Project, Set and select the folder where meshes or whatever it is.
Because ClearCase updates directory version numbers when files inside are created, our config-spec generating script is failing (details omitted).
So, as an example, given a file such as "/proj/src/scripts/build.sh##/main/branch42/3", how can we determine the latest version of the scripts directory that contains that version of the build.sh file.
Note: we're looking for a unix command-line solution that can be scripted.
If you do a ls /proj/src/scripts##/main/branch42/*/build.sh/main/branch42/3 you should get a list of all versions of the scripts directory that contain version .../3 of build.sh. Then you should be able to pick out the latest of those.
The above is probably not a fool proof approach, so you might try something more like
cleartool find /proj/src/scripts --allversions --nonvisible -name build.sh -version 'brtype(branch42) && version(3)' -print
(I no longer have a clearcase environment to test in, so the above is from memory and is not an accurate command)
Another approach is to:
set a label on the right version of the build.sh script and its directory (you can move that label when needed)
have a second dynamic view always configured to select that label
element * SCRIPT_LABEL
element /proj/... .../branch42/LATEST
That way, you simply read the information you need from that second dynamic view.