Is there any way to download a folder : all files within the folder and subfolders in Liferay 6.2 without using a loop through all files existing in the folder ?
I need to do it programmatically.
Example :
Folder to download "XFolder"
XFolder
- SubFolder1
- File11
- File12
- SubFolder2
- File21
- File22
- File1
- File2
When choosing to download XFolder, the system searches the folder in document and media and saves all the folder content in a .zip file in disk.
The content should have the same structure above.
Thank you for your help.
You can try to use the "treePath" value of folder and entry to figure out the files but you still will require some looping.
You will probably need dynamic queries for this.
the algorithm should go something like this.
Find out ID of your folder
Look through the treePath property of the Folder table and get a list of all paths that you are interested in.
get all folder ids
loop through all the folders that you are interested in and load their respective files. (Probably you could also do a query that would collect it all in one go)
Related
I am trying to create a folder which contains uploaded files. I have seen some examples that saving files into the absolute folder such as D:/tmp or Home directory. My question is I am trying to put my uploaded files into a folder which is inside the project folder.
I also tried to get project folder using like this :
public static String getProjectFolder(){
return System.getProperty("user.dir")+"/";
}
Result become something like this, and file not found exception inside the Html file!
http://localhost:1234/Users/USER_NAME/Documents/java/PROJECT_NAME/upload/genres/action.jpg
What is the best way to add folder into my project? Or should I use hardcoded folder for it ?
You need to set the folder that you want to upload files to as the static files folder using staticFiles.externalLocation().
The only folder the client can reach, either for getting content from OR uploading to, is the folder you set using the static files location API staticFiles.externalLocation(). You can see also an example for that here.
When I run my server locally, I define it to be:
staticFiles.externalLocation(System.getProperty("user.dir") + "/src/main/resources");
This is regarding what your question.
You might run into an issue though. Because now you probably have two locations that you want public:
The resources folder (with all the JavaScripts, CSSs, etc. Typically /src/main/resources)
Upload folder (to let the user upload files)
Having both of these the same location is not a good practice. I managed to resolve that by creating a symbolic link called files inside the public folder.
abcmbp:resources abc$ pwd
/Users/abc/dev/wspace/proj1/src/main/resources
abcmbp:resources abc$ ls -l files
lrwxr-xr-x 1 abc staff 27 Mar 3 21:20 files -> /Users/abc/appUploadFolder/
Then, in the post handle of the uploading path, I give this folder as the destination, and this way I have a separation between resources and uploaded files.
I want to create a hidden folder in user's Google drive root directory and then want to insert some text files in that folder and later want to retrieve that files. I tried the quick guide and files are uploading fine but in the root directory and files are visible to user. From here I know how to create an empty folder. . But from here I do not understand how to use that code to insert the file in a particular folder.
So my Question is how to create hidden folder and perform CURD operations on files using drive API.
You're looking for the appdata folder. See here:
https://developers.google.com/drive/appdata
I am trying to install Oracle 11g in my laptop. Im downloading the setup files from here:
http://www.oracle.com/technetwork/database/enterprise-edition/downloads/112010-win64soft-094461.html
I have downloaded win64_11gR2_database_1of2.zip and win64_11gR2_database_2of2.zip.
I have put them in the same folder and started the setup file from the 1of2 folder. I go until certain steps and finally during installation i get WFMLRSVCApp.ear file not found popup.
I googled and i see some solutions where 1of2 and 2of2 file should be unzipped to same folder and then start setup. I did the same couple of times but still im getting the same error. Any anyone guess what is missing?
extract win64_11gR2_database_1of2.zip into win64_11gR2_database_1of2 folder first.
Then extract win64_11gR2_database_2of2.zip into win64_11gR2_database_2of2 folder.
copy all 4 files in database/ stage/ components folder in win64_11gR2_database_2of2 folder(unziped) & paste them (no replacement) in database/ stage/ components folder in win64_11gR2_database_1of2 (unziped).
Then run the setup again. I experienced in it. It works..
What you have to do is copy what is inside components folder ( i think four files ) in win64_11gR2_database_2of2.zip and paste it inside the win64_11gR2_database_1of2.zip components folder and re run the setup . it works
If you are installing the Oracle Identity Management 11gR2, you might receive the WFMLRSVCApp.ear file missing during Installation error during the database installation.
The way to resolve this error is:
Make sure you downloaded two disk
win64_11gR2_database_1of2.zip
win64_11gR2_database_2of2.zip
Steps:
Right click the win64_11gR2_database_1of2.zip file and select
Extract Here.
The software will extract in the folder named database as below,
You can see the following folders and files under database\stage, note the Date modifiedfor Components folder.
Do the same for win64_11gR2_database_2of2.zip file and click extract here, the extracted file will be placed in the same database folder
Now check the Date modified
That's it, now you can start by clicking setup.exe under database folder.
Hope it helps to understand easily.!!
I had the same problem but it's an easy one to solve: Download WinMerge and use it to merge the 2 folders that come out of the zip file from Oracle. That will do it.
http://winmerge.org/
1) Normally extract win64_11gR2_database_1of2.zip and win64_11gR2_database_2of2.zip
2) Copy directory
C:\Users\Fatality\Downloads\win64_11gR2_database_2of2\database\stage\Components (from extracted win64_11gR2_database_2of2 directory)
to
C:\Users\Fatality\Downloads\win64_11gR2_database_1of2\database\stage\Components (in extracted win64_11gR2_database_1of2 directory)
After searching 1 hour i do not found any solution to my problem.
I want to move a file from sdcard to assets folder and also overwrite the existing file in assets folder (both file are sqlite database have same name with just a little difference in data )
??
Actually, The behaviour of the android .apk file is read only so the directory structure which are in that apk file follows the same, So no one can write this files or make changes on that at runtime,that's why You can't make a changes in /asset folder at runtime. you can read file from it (means copy files which are available in asset to any internal storage or /sdcard but not write it to vice-versa)
Its apply on all the directories which are build in .apk files. As per docs.
Assets folder are not Writable it is only readable so you cant copy from sdcard to assets, yes you can copy from assets to sdcard
If you want other apps not to access your database then what you can do is
Download the database from website. create a temp database also in app directory.
getDatabasePath() this will give you the path of the dummy database you have created now replace this with the one you downloaded.
PS.: User and apps having root access still able to access it and you cant do anything in that scenario
i want to download folder containing files like pdf,jpg,png etc from web services.I have written a application that can download pdf,png file.But i want to download folder containing several files. So my question is- is it possible to download folder and if yes then how can i download folder from server in android. thank you
If you can download one file, why wouldn't you be able to download several? Create the folder on Android, queue the files and start the next download when the current is finished, filling the folder. Also Android supports ZIP, so that might be your best call.
Folder is nothing but an FILE but a different type of file. Once you get the folder you can list down the files in it. You already have URL with the folder, u just need to append the URL of the folder to the files in it and download them one by one.