Need to implement archive/backup features for Liferay 6.2 Document Library with the AdvancedFileSystemStore as given below.
dl.store.impl=com.liferay.portlet.documentlibrary.store.AdvancedFileSystemStore
I have the two below scenarios. Please suggest if there are any Liferay OOB features that can be used to accomplish the below OR any pointers on how to achieve this using custom development.
Scenario 1:
Have only a single Site which has different folders containing various documents in Documents and Media Section. These folders need to be backed up periodically - say once every week. The logical folder hierarchy and the documents should be preserved in the archive folder.
For Example:
Sample Site 1 > Documents and Media > RootFolder > Folder1 > File1
Sample Site 1 > Documents and Media > RootFolder > Folder1 > File2
Sample Site 1 > Documents and Media > RootFolder > Folder2 > File1
Sample Site 1 > Documents and Media > RootFolder > Folder2 > File2
After backup this structure in archive directory should be:
ArchiveFolder > RootFolder > Folder1 > File1
ArchiveFolder > RootFolder > Folder1 > File2
ArchiveFolder > RootFolder > Folder2 > File1
ArchiveFolder > RootFolder > Folder2 > File2
Scenario 2:
Have multiple sites each with different folders containing various documents in their respective Documents and Media section. All these folders need to be backed up periodically - say once every week. The logical folder hierarchy and the documents should be preserved in the archive folder.
For Example:
Sample Site 1 > Documents and Media > RootFolder > Folder1 > File1
Sample Site 1 > Documents and Media > RootFolder > Folder1 > File2
Sample Site 2 > Documents and Media > RootFolder > Folder1 > File1
Sample Site 2 > Documents and Media > RootFolder > Folder1 > File2
After backup this structure in archive directory should be:
ArchiveFolder > Sample Site 1 > RootFolder > Folder1 > File1
ArchiveFolder > Sample Site 1 > RootFolder > Folder1 > File2
ArchiveFolder > Sample Site 2 > RootFolder > Folder1 > File1
ArchiveFolder > Sample Site 2 > RootFolder > Folder1 > File2
In my mind a good solution can be a custom portlet.
For defining folders you can choose between:
- user interface where administrator put source/destination folder id and group id
- a property file in which reading ids
For scheduled operation you can choose between:
- a scheduled operation (defined in liferay-portlet.xml)
- a service invoked by an automatic system cronjob
Working with files is very simple in Liferay (for visiting and copying any "node" in the Document Library tree structure): don't care about specific store.impl... using Documents API (available starting from LR 6.1) you will have a very powerful (and high-level) way to work on document library.
Related
My question is pretty quick to explain, I don't know about the solution.
I have a folder always containing 3 folders that can themself contained others folder. I would like to be able to remove only a specific folder from all 3 firsts folders. Here how I picture the thing :
For example here I would like with a single command to remove all folder named Folder 1 under the User folder (if it's possible, if not using a shell script could do the trick)
> User_folder
> Folder_A
> Folder_1 --> To remove
> Folder_2
> Folder_3
> Folder_4
> Folder_B
> Folder_1 --> To remove
> Folder_5
> Folder_6
> Folder_7
> Folder_C
> Folder_1 --> To remove
> Folder_2
> Folder_4
> Folder_5
Say for example, in the source directory I have the following files:
abc.r
xyz.sh
pqr.fam
lmn.bim
uvw.r
ttt.sh
Now I need to link only the items 1,2 and 5 only (listed above). Most importantly I need to link all the 3 files together (i.e. link all the 3 files at the same time).
I know how to link 1 file at a time (ln -s sourceDirectory/fileName targetDirectory/), but not multiple files at once.
I found ways to do this when the file name prefixes has some pattern (for example, link all the files where the names start with letter "f"), but in my case, I do not have any such pattern. My file names are different.
Try this:
#!/bin/bash
for file in a.txt b.txt c.txt
do
ln -s /sourcedir/"${file}" /targetdir/
done
Since you only have a list, you have to iterate through the list.
How can I create a Folder when I prompt a user to enter how many folders he wants to create in unix?Lets say for example the user input 5 it should create a Five folder name folder1, folder2 ,folder3, folder4 ,folder5. How can i do this in unix?
I supose you will do this with a bash script. In that case you can use a loop and the mkdir command. For example:
#!/bin/bash
read -p "How many folders?" num_folder
for (( i = 1; i <= num_folder; i++ )); do
mkdir folder$i
done
this will create 4 folders with the names folder1, folder2, folder3 and folder4.
You can ask the user how many he wants this way :
read -p "How many folders do you want to create ? : " numberoffolder
Then use the var $numberoffolder to loop & name folders
Question:
How do I move files from many sub-directories with the same name to a single directory of that name. All files in multiple directories named X should get moved together into one directory named X.
Example file structure:
(The real structure is 200-300 directories at the level I've marked as 1, 2, 3, etc., with varying numbers of directories below that.)
(Note all labels like Group _ are just that--labels. The actual names are irregular.)
Disk
1
Library
Music
Group A
Files
Files
Files
Group B
Files
Files
Files
2
Library
Music
Group B
Files
Files
Files
Group C
Files
Files
Files
3
Library
Music
Group C
Files
Files
Files
Group D
Files
Files
Files
The goal is to have files in various sub-directories with name "Group X" moved into a single directory with name "Group X", like so:
Disk
1
Library
Music
Group A
Files
Files
Files
Group B
Files
Files
Files
Files
Files
Files
Group C
Files
Files
Files
Files
Files
Files
Group D
Files
Files
Files
Thanks!
You would do something like:
dest="Group A"
find -type f |
grep $dest |
while read filename
do
echo mv $filename ${dest}/$(basename $filename)
done
I would like to know if there is any way to compress a set of .txt files in a folder using scripting when the number of files get more than a set limit.
The txt files are automatically generated by another script.
You can use array size to detect the number of files:
limit=100
files=(*.txt)
if (( ${#files[#]} > limit )) ; then
zip archive.zip *.txt
fi
It sounds like you want logrotate with a custom (non-/etc) configuration file with rules for compressing/removing by size.