file-management

Moving files to appropriate location based on their extension

大兔子大兔子 提交于 2019-12-22 08:36:35
问题 I have a cleanup script that moves files based on their extension to appropriate preset locations. For example, a file with the extension .xls will be moved to ~\XLS folder, .sql to ~\SQL and so on. Here is the my script. $dirtyfolder = "\\server\c$\Documents and Settings\user\Desktop\" $org = "\\BACKUPS\users\" dir $dirtyfolder -fil *.doc | mv -dest "$($org)ORG\doc" dir $dirtyfolder -fil *.txt | mv -dest "$($org)ORG\txt" dir $dirtyfolder -fil *.sql | mv -dest "$($org)ORG\sql" dir

Best way to store/retrieve millions of files when their meta-data is in a SQL Database

别等时光非礼了梦想. 提交于 2019-12-21 09:29:04
问题 I have a process that's going to initially generate 3-4 million PDF files, and continue at the rate of 80K/day. They'll be pretty small (50K) each, but what I'm worried about is how to manage the total mass of files I'm generating for easy lookup. Some details: I'll have some other steps to run once a file have been generated, and there will be a few servers participating, so I'll need to watch for files as they're generated. Once generated, the files will be available though a lookup process

How to download all files and folder hierarchy from Jupyter Notebook?

不问归期 提交于 2019-12-20 10:58:00
问题 If I want to download all of the files and folder hierarchy from Jupyter Notebook as shown in the picture, do you know if there is anyway to do that by simple click other than go to every single file in every folder to open the file and click download hundreds of times? Note: This Jupyter Notebook is created by the online course teacher, so it's not opened from my local Acaconda app but the online course webpage instead. Downloading is for future memory refreshing whenever needed. 回答1: import

Determine recursively both COUNT and SUM of all extensions in a folder

会有一股神秘感。 提交于 2019-12-18 06:57:21
问题 I would like to be able to select a remote folder and scan it recursively for all file extensions. For each extension discovered, I would need a total count and well as the sum for individual file types. I've found a script here that works for a single file extension using the -include switch, but rather than running the script scores of times, it would be nice to simply run once and collect all extensions. $hostname=hostname $directory = "D:\foo" $FolderItems = Get-ChildItem $directory

Secure contents in Documents directory

跟風遠走 提交于 2019-12-18 02:59:53
问题 Can anyone help me to make the contents of my Documents directory secure? 回答1: Use: - (BOOL)writeToFile:(NSString *)path options:(NSDataWritingOptions)mask error:(NSError **)errorPtr with one of the file protection options: NSDataWritingFileProtectionComplete (iOS 4.0) NSDataWritingFileProtectionCompleteUnlessOpen (iOS 5.0) NSDataWritingFileProtectionCompleteUntilFirstUserAuthentication (iOS 5.0) See: Apple Documentation NSDataWritingFileProtectionComplete In this case, the file is stored in

File management in Javascript

一世执手 提交于 2019-12-13 10:37:11
问题 How to write to a file in Javascript(on server)? I also need to read the file. And here is my code: function write() { var = true; if( var = true) { //write file } } function read() { //read file } 回答1: Writing a file is not a feature of Javascript. In some recent browsers you can already read them, but it's not a good option. The best way is to read it with PHP and get the response with XMLHttpRequest. JavaScript var xhr = XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject('Microsoft

Why does CreateFile return invalid handle?

我们两清 提交于 2019-12-13 04:33:33
问题 I have CreateFile() to create a hidden file type but the problem that it keeps returning invalid handle. file = CreateFileW(_T("hey.txt"), GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, 0); error = GetLastError(); WriteFile(file, buff, sizeof(buff), &dwRet, NULL); Any idea? 回答1: It would probably be best if you showed the exact code that you're using including all the error checking, and how you do it, is important (especially in the case of this question)... The correct error checking for your

iOS - Reading an Audio file from Documents Directory

梦想的初衷 提交于 2019-12-13 01:10:32
问题 I am saving audio data to the Documents directory and trying to read it back. If I play it back immediately it plays successfully, however, if I start a new session and try and play the song locally it will fail even though listing the files in the Documents directory shows that my file is still there. Note that the file is played back from the Documents folder in the same way (same code) if it is played immediately or during a new session. Here is how I save the audio data to the Documents

Remove all files in a directory

亡梦爱人 提交于 2019-12-12 07:09:15
问题 Trying to remove all of the files in a certain directory gives me the follwing error: OSError: [Errno 2] No such file or directory: '/home/me/test/*' The code I'm running is: import os test = "/home/me/test/*" os.remove(test) 回答1: os.remove() does not work on a directory, and os.rmdir() will only work on an empty directory. And Python won't automatically expand "/home/me/test/*" like some shells do. You can use shutil.rmtree() on the directory to do this, however. import shutil shutil.rmtree(

Passing a filename to a view

让人想犯罪 __ 提交于 2019-12-12 03:45:18
问题 I am trying to build a simple CMS which allows the author to upload files (specifically images but the file type is not really important for now). The upload of the file is working fine. However I want to provide the ability to list and subsequently delete a file (maybe later multiple files but for now a single file at a time is fine). I have looked around the net. I see plenty of examples using EF to store the location of the file in a DB because they have permissions and roles etc. While