how save a folder with some sub folders and files in mnt->sdcard? - android-sdcard

I want save a folder with some sub folders and files in mnt->sdcard on emulator from DDMS.I can save files one after other but I cant save many files at a time or cant save a folder totally in sdcard because I am new by android.I did some searches but can not doing my job yet.what do i do?

maybe this?
File root = new File(Environment
.getExternalStorageDirectory()+"/myPrivateFolder");
if(!root.exists()){
root.mkdir();
}
else{
File[] files = root.listFiles(); //access your files
}
File myFile = new File(Environment
.getExternalStorageDirectory()+"/myPrivateFolder/myFile.txt");
myFile.createNewFile(); // creating file
don ever hardcoe "/sdcard" or smth like this. for more convenient method of navigation each File has methods for accessing abosulutePath, getting info about is file or folder or even exists and other

Related

List all files and delete thorugh ipfs-http-client

I upload image and video thorught ipfs client.
I use add method in this way:
let data = {
content: bufferFile,
path: path
}
const result = await client.add(data)
return result
Path is only the name of the file, I don't use any folder, so I think files are saved in the root folder.
I want to obtain all the files in the root folder, but ls method of the library wants cid folder (that I don't know).
Then I obtain file I want to delete them, but now I can't because I don't know their cid.
Can you help me?

How to copy existing files into a zip folder in Julia

I am trying to copy some existing files (using full file paths) into a zip folder that I have created using the Julia Language.
So far I have tried both ZipFile.jl and InfoZIP and neither package has been able to add existing files to the zip folder, just create new one to write into. If anyone has any tips for how to generate a new zip folder and fill it with pre-existing files I would greatly appreciate it.
Thanks
Basically you can read each file and write it into the archive :
w = ZipFile.Writer("archive.zip")
for filepath in filelist
f = open(filepath, "r")
content = read(f, String)
close(f)
zf = ZipFile.addfile(w, basename(filepath));
write(zf, content)
end
close(w)

Im am getting FileNotFoundError when trying to create a for in loop

I am making an image classifier. I have successfully created the folders and I manually placed the .txt files which has links to images from google inside each folder.
I am now trying to download the images from each .txt file either into a folder inside each folder category, or into each category folder that also has the .txt file, however i keep getting errors. please help.
I manually placed the .txt files in each of the folders as they was in the parent folder name as PLANTS but this has not made a difference.
I expected to get all the images downloaded in their respective folders from the .txt files with google image links but it is not working, whether the .txt is inside the main PLANTS FOLDER or inside each category folder which is inside the PLANTS folder
instead i get the below errors
FileNotFoundError
please see attached screen shot
&
Long filenames or paths with spaces are supported by NTFS in Windows NT. However, these filenames or directory names require quotation marks around them when they are specified in a command prompt operation. Failure to use the quotation marks results in the error message.
for i in range(len(folders)):
path = "content/gdrive/My Drive/Colab Notebooks/Flowers/PLANTS"
#for creating directory we need path class object so below this:
dest_for_creating_directory = path/folders[i]
#for searchi directory which have spaces we need doubleQuotations that
#why user below one in download image function instead of dest.
dest_for_searching_directory = path+"/"+folders[i]
Note: its better practice to write folder/file name without space more info

Name a folder when zipping a file in node

I am creating a zip file with JSZip but I have a very specific requirement that I can't figure out how to do.
When this file is unzipped it needs to create a folder with two files inside it. Let's say foo.zip unzips to create a folder foo with files bar.mp4 and baz.png.
So far that's easy enough I can just go
let zip = new Zip()
let folder = zip.folder('foo')
folder.file(`bar.mp4`, videoData)
folder.file(`baz.png`, imageData)
// Save as foo.zip
But what I need to happen is if I rename foo.zip to horse.zip then the folder created should be called horse. If I use the above code then it will always be called foo. I know this is possible because I have several zip files that currently do this.
Edit: I'm not tied to JSZip here either. I'm happy to do this any way that's possible. Code will only be run on the server.

Excel Object in asp.net

I have a serious issue.
I am using excel object for opening the excel file
it works fine i my PC.
when i make application as a website and running the page and uploading it gives the error "'C:\Documents and Settings\Administrator\Desktop\Work\SABRE MSO Mapping Request Template.xlsx' could not be found. Check the spelling of the file name, and verify that the file location is correct. If you are trying to open the file from your list of most recently used files, make sure that the file has not been renamed, moved, or deleted. ".
I think it taking server path...but i want to open client excel file before saving the file to the server.
Plz help.
have you tried server.mappath() method ?? Do you have proper permissions setup to access the folder??
Are you passing complete file path to the excel for opening the file? Please try this:
if (fileUpload.HasFile)
{
string fileName = "PATH_RELATIVE_TO_YOUR_SITE" + "FILE_NAME";
fileUpload.PostedFile.SaveAs(fileName);
//NOW open excel using fileName;
}
also you need write permissions to the path (folder) you are writing file to.

Resources