I know there is no folder or directory concept on Amazon S3, but I want to update or delete a folder according to my app's users needs.
To Delete folder I guess I have to delete all the files one by one in a folder with:
- (S3DeleteObjectResponse *)deleteObjectWithKey:(NSString *)theKey withBucket:(NSString *)theBucket
http://docs.aws.amazon.com/AWSiOSSDK/latest/Classes/AmazonS3Client.html#tasks
But there is no documentation to update a object name
Lets say my folder name is photos and there are two files in that folder image.png and image2.png that means I have
photos/
photos/image.png
photos/image2.png
I want to change folder name to photos1 that means I have to change image.png and image2.png to:
photos1/
photos1/image.png
photos1/image2.png
How can I accomplish this?
Is this the closest I can get? (copyObject)
Your thinking is correct. You can't rename a 'folder'. You must process each file individually by creating a copy with the desired name and deleting the original.
Also, be aware that according to the docs (http://docs.amazonwebservices.com/AmazonS3/latest/API/index.html?RESTObjectCOPY.html) the copy operation does not preserve the ACL, so if the moved files are public you need to explicitly mark the copies as public as well.
Related: How to rename a folder inside a bucket using the AmazonS3.net sdk
Related
$link= PS_ADMIN_DIR;
$admin_folder = substr(strrchr($link, "\ "), 1);
currently i am using this way to get folder name,
But if there are any direct method or any constant please suggest me..
Thanks
To be a little bit more specific : the name of the admin directory is on the filesystem.
When you access a page of the admin directory, a script puts the current directory's path in the _PS_ADMIN_DIR_ constant.
If you forgot the name of the the admin directory you must have a look at the filesystem of your server.
Admin directories are automatically renamed to something like adminXXXX.
If you named it differently you can compare the default directory structure with your actual structure and find the proper directory.
You can also look for files that are only present in the admin directory. The "get-file-admin.php" file for example.
On linux, the following command run from the prestashop root directory will tell you the actual name of the admin directory :
find ./ -name get-file-admin.php
For security reasons, admin folder name is not stored anywhere in your PrestaShop's files or database, so you have to do something like you do to find it.
However, you should use _PS_ADMIN_DIR_ instead of PS_ADMIN_DIR as the second one is not defined directly by PrestaShop and could be undefined.
I am looking for the Flume "Spooling Directory Source" recursive-look for the the files within subdirectories.
There are some references here https://issues.apache.org/jira/browse/FLUME-1899
however since then multiple versions have come out, is there any way we can have recursive directory lookup within subdirectories for the files in Spooling Source.
I think you can use the patch FLUME-1899-2.patch directly.
set the "recursiveDirectorySearch" as ture in your config file.
NOTE: the regex in ignorePattern of config file will also affect the recursiveDirectory folder name. so you might need to modify the code in org/apache/flume/client/avro/ReliableSpoolingFileEventReader.java if you want to ignore the folder name.
Probably a silly question, but how do I get the path to the /public folder in Dancer?
I want to store/read csv files under the public folder, but don't know if Dancer offers any convenience methods to get the base path to the public folder.
The error I get when trying to create a file by saying:
open(FILE, ">>", "myapp/public/file.csv") or die "$!";
is:
No such file or directory in /ur/share/perl5/Dancer/Handler.pm l. 98
I'm not sure why it's going to Handler.pm?
My first answer is, don't do it that way...for two reasons:
You're potentially opening up a security issue. What if somehow a hacker figures out a way to write to your environment files, change your passwords, etc.?
You really want your /public files to be static, for version control, portability, etc.
That being said, if you really still want to do this, the public dir lives in config->{public}:
print "Public dir:".config->{public}."\n";
Source:
http://search.cpan.org/~xsawyerx/Dancer-1.3110/lib/Dancer/Config.pm#public_%28directory%29
I have images in uitableview, they each have a string for they're path in documents directory.
Now my trouble is if somebody adds the same image they will have the same path.
I was thinking of making an if-statement that will run on all of my fetchedResultsController objects or better yet my entire documents directory and append a number or something to the pathString.
lets say user adds title.jpg to doc directory, then he adds the same image then I want a check to see if it already exists, if it already exists in doc directory then append title(1).jpg so it can save properly and so on.
any efficient way of doing that ?
Depending on the OS you're targeting you can set the image name using NSUUID. If you're targeting < iOS 6 you'll have to use CFUUIDRef. This will always ensure you have a unique filename for an image.
I have a zip file named test.zip which contains a directory named invoice. Inside the invoice directory there are documents each with different names. I would like to find a specific document named summary.txt which is inside the invoice directory.
I am able to get a handle to test.zip using the following:
zip = Zip::ZipFile.open("/path/to/test.zip")
but when I use
zip.find_entry("summary.txt")
I get nil.
On the other hand, if summary.txt is not inside the the invoices directory, but rather at the root of the zip file itself, the find_entry method as described above seems to work.
It seems that somehow I must navigate down into the invoices directory before searching for summary.txt.
Is this correct? If so, how do I do it? If not, what I am I doing wrong.
You need to specify the full path to the file:
zip.find_entry 'invoices/summary.txt'