CHECKIN FOLDERS AND FILES IN A DIRECTORY RECURSIVELY IN ORACLE ADE
This script will do the following:
1) ade mkdir all directories recursively
2) ade mkelem all files recursively
3) copy the contents of files in reference folder to the create files in ade view
Steps to execute it:
1) Create an ade view based on a label
2) Use view=> ade Use view
3) Set the variable 'ref' to the reference root folder with full location
Eg. setenv ref /scratch/cthiyaga/temp/ROOT
* Do cp2local of all files and dirs under $ref if needed
4) Create the new folder "ROOT" in appropriate ade location and Set the variable 'cur' to the new folder with full ade location
Eg. Suppose you want create the new folder "ROOT" in location in the location "/scratch/cthiyaga/view_storage/cthiyaga_case_view/bpm"
Then=>
ade mkdir /scratch/cthiyaga/view_storage/cthiyaga_view/bpm/ROOT
setenv cur /scratch/cthiyaga/view_storage/cthiyaga_view/bpm/ROOT
5) copy the attached file in some location and run perl checkinAdeDirRecurse.pl
After the script execution , you can check the files and then continue with check in and merge of the the files as usual process.
Perl Script to be used. checkinAdeDirRecurse.pl
#!/usr/local/bin/perl
# set the env variables $ref and $cur
# set $cur to new Ade dir
# set $ref to dir from where u want to copy
# Do cp2local of all files and dirs under $ref if needed
$f_FilesList="/tmp/files.log";
$f_Dirslist="/tmp/dirs.log";
#$ref="/scratch/cthiyaga/CaseMgmt/EURentdemo/EURent";
#$cur="/scratch/cthiyaga/view_storage/cthiyaga_casemgt_ps6_auto_view/bpm/qa/bpmr2tests/oracle/casemanagement/samples/EURent";
$ref=$ENV{'ref'};
$cur=$ENV{'cur'};
print "ref is $ref\n cur is $cur";
chdir $ref;
system("find . -type d | tee $f_Dirslist");
system("find . -type f | tee $f_FilesList");
system ("ade mkdir $cur");
chdir $cur;
open(FH, "< $f_Dirslist");
@contents=;
close(FH);
chdir $cur;
foreach $line(@contents) {
chomp $line;
if($line ne '.'){
system ("ade mkdir $line");
#print "ade mkdir $line\n";
}
}
open(FH, "< $f_FilesList");
@contents=;
close(FH);
chdir $cur;
foreach $line(@contents) {
chomp $line;
system ("ade mkelem $line -nc");
system ("cp $ref/$line $cur/$line");
#print "ade mkelem $line \n";
#print "cp $ref/$line $cur/$line\n";
}
Note:
To undo check-in execute below commands
ade unmkelem -all
ade unco -all
ade cleanview
To undo check-in execute below commands
ade unmkelem -all
ade unco -all
ade cleanview
2 comments:
Pretty useful utility ! thanks for posting it
I am getting the following error. Any idea:
syntax error at checkindir.pl line 23, near "=;"
syntax error at checkindir.pl line 36, near "=;"
Execution of checkindir.pl aborted due to compilation errors.
Thanks,
Ranjit G M
Post a Comment