replacing content from cache to document directory? - objective-c

In my Document folder i am having a folder named folder1 in that folder i am having css,js,main.html etc.. i am opening the main.html in webview....If any updates are done in server i am downloading folder2 and unzipping it in cache directory For example: i am having css,js ,main.html in folder1 in document directory and a new update is done in server and i am downloading folder2 and unzipping in cache directory in folder2 i am having css only now i want to compare these folder1 and folder2 content if equal means in this example css is present in both the folders i want to delete css in document directory folder1 and i want to replace the css which is in folder2 to folder1...this is the process next time if any update is done then i may download js not css at that time i want to replace only js.can any one help how to check the content and replace ... please help me its imp to me

As per my understanding, you are using Documents directory to store the CSS and HTML to be loaded inside UIWebView and Caches directory to unzip and store latest CSS and HTML files from the server. After unzipping, you want to compare the contents of CSS and JS files in Caches folder with the contents of CSS and JS files in Documents folder and replace if they have changed.
There are 2 steps in this:
Standardizing files names across both folders so that you know which file from Caches directory should be compared with which file from Documents directory. Give the same names to files that are to be compared.
On fetching the file from server and unzipping in Caches folder, you can get use NSFileManager class to access the same file (names are same as mentioned in point 1) in your Documents directory and then read it in an NSString and then compare that with another NSString that contains your Caches folder content. If the comparison returns equal you can skip. Else, you can use
NSFileManager *manager = [NSFileManager defaultManager];
[manager copyItemAtPath:sourcePath(CachesDir) toPath:destinationPath(DocumentsDir) error:&error]
This will copy your latest unzipped item from CacheDirectory to Documents Directory.
However, you may want to double check saving content in Documents Directory as it is backed-up on iCloud account to which the device is mapped. Please read about this further.

Related

Apple Automator to add password to all files within a folder including subfolders and over right files

I have a folder with multiple subfolders, each subfolder contains 1 or more PDF files.
I would like to add password to each file and save over.
My current automator, can get all the files, add password, but then cannot replace the files into their original folders.

Nuxt: displaying an image from contents directory

I have a use-case wherein the contents directory besides the markdown and yaml files I have images too. Reason being it is convenient to have a set of related files in a subdirectory. I am aware of displaying images using the assets and static directories.
The Content directory is as shown:
content
- topics
- topic-a
content.yaml
cover.png
- topic-b
content.yaml
cover.png
Is there a way to access the png and display it? Thanks.

How to copy artifacts folder to ftp folder in TFS?

I'm trying to publish artifacts and it's other folders files as well.I've read all the docs file provide by microsoft from here and used them but none of them worked for me.
I' tried File patterns as
** =>which copied all root files to ftp
**\* => which copied all sub folders file to ftp's root directory.
What I've wanted is copy folder to folder in ftp aswell.
-artifacts ftp
--a.dll --a.dll
--subfolder --subfolder
---subfolder_1.dll ---subfolder_1.dll
what's happening is
ftp
--a.dll
--subfolder_1.dll
It's copying all sub directories file to root directory of ftp.
I've use curl and ftp both giving me same result.
How can i achieve folder to folder copy in TFS 2017.
It's not related File patterns, to upload the entire folder content recursively, simply specify **.
All you have to do is checking the Preserve file paths in Advanced option.
If selected, the relative local directory structure is recreated under
the remote directory where files are uploaded. Otherwise, files are
uploaded directly to the remote directory without creating additional
subdirectories.
For example, suppose your source folder is: /home/user/source/ and
contains the file: foo/bar/foobar.txt, and your remote directory
is: /uploads/. If selected, the file is uploaded to:
/uploads/foo/bar/foobar.txt. Otherwise, to: /uploads/foobar.txt.

Apache htaccess setting default index.html or <folder name>.html

We have an automated legacy system that provides zip files with html content (including images and other files). The system will either provide a folder with an index file or a file with the name as the folder.
For example say the file being sent in was User Supplies.zip
We would either see a folder structure like this
User Supplies/index.html
or like this
User Supplies/User Supplies.html
Currently we examine the contents for the zip file and rename anything that matches the folder name back to index.html. Since there could be other html files in there it has become a bit of spaghetti code to get it to work.
We could get rid of all this code if we can include something to the equivalent of "Use index.html or [folder name].html as the default file"

iOS save all files from remote directory at local document directory

I am properly sending a nsurlrequest to download a known path file and then save it to document directory. However, now I need to download all files that a remote directory contains. I know path for directory but not which files are inside. How to list that files in order to build paths to download it? Thank you.
Unfortunately unless you parsed a index file containing a list of the files, this is not possible as the HTTP protocol does not support directory listing. You would have to use an FTP server instead