file-management

Delete a large number (>100K) of files with c# whilst maintaining performance in a web application?

前提是你 提交于 2019-11-30 06:45:24
I am trying to remove a large number of files from a location (by large I mean over 100000), whereby the action is initated from a web page. Obviously I could just use string[] files = System.IO.Directory.GetFiles("path with files to delete"); foreach (var file in files) { IO.File.Delete(file); } Directory.GetFiles http://msdn.microsoft.com/en-us/library/wz42302f.aspx This method has already been posted a few times: How to delete all files and folders in a directory? and Delete files from directory if filename contains a certain word But the problem with this method is that if you have say a

NSFileManager unique file names

雨燕双飞 提交于 2019-11-29 20:36:04
I need a quick and easy way to store files with unique file names on iOS. I need to prefix the file with a string, and then append the generated unique identifier to the end. I was hoping NSFileManager had some convenient method to do this, but I can't seem to find it. I was looking at createFileAtPath:contents:attributes: , but am unsure if the attributes will give me that unique file name. Create your own file name: CFUUIDRef uuid = CFUUIDCreate(NULL); CFStringRef uuidString = CFUUIDCreateString(NULL, uuid); CFRelease(uuid); NSString *uniqueFileName = [NSString stringWithFormat:@"%@%@",

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

耗尽温柔 提交于 2019-11-29 11:28:43
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 -recurse -Include *.txt $Measurement = $FolderItems | Measure-Object -property length -sum $colitems =

Delete a large number (>100K) of files with c# whilst maintaining performance in a web application?

为君一笑 提交于 2019-11-29 08:06:47
问题 I am trying to remove a large number of files from a location (by large I mean over 100000), whereby the action is initated from a web page. Obviously I could just use string[] files = System.IO.Directory.GetFiles("path with files to delete"); foreach (var file in files) { IO.File.Delete(file); } Directory.GetFiles http://msdn.microsoft.com/en-us/library/wz42302f.aspx This method has already been posted a few times: How to delete all files and folders in a directory? and Delete files from

NSFileManager unique file names

筅森魡賤 提交于 2019-11-28 16:16:24
问题 I need a quick and easy way to store files with unique file names on iOS. I need to prefix the file with a string, and then append the generated unique identifier to the end. I was hoping NSFileManager had some convenient method to do this, but I can't seem to find it. I was looking at createFileAtPath:contents:attributes: , but am unsure if the attributes will give me that unique file name. 回答1: Create your own file name: CFUUIDRef uuid = CFUUIDCreate(NULL); CFStringRef uuidString =

Cycle through a directory and get paths of all the files and folders [closed]

时光怂恿深爱的人放手 提交于 2019-11-28 14:40:59
Hello there im stuck on this thing where i need to cycle through a certain dir that i need to get all the file names from and get there paths as a variable. I know how to create a loop, but to get the directory's contents, I do not. Any help is appreciated, thanks! Hussain Shabbir Try like this: // If your folder is a document. NSString *docsDir = [NSHomeDirectory() stringByAppendingPathComponent: @"Documents"]; // else you can give your folder path as well, if you know // for example like this NSString *docsDir = @"user/desktop/testFolder" NSFileManager *localFileManager = [NSFileManager

Where does Visual Studio search for txt files when conducting file management operations?

痞子三分冷 提交于 2019-11-28 07:22:58
问题 I know this is a noob question, but I've worked with Python before and when you wanted to simply access a .txt file for example, all you had to do was make sure the txt file was in the same directory. I have the following C++ code below but it's not finding the Numbers.txt file that I have saved on my desktop. All I have in the file is one line of numbers of type double. All I want to do is to find the average of all of the numbers in the file. The program runs fine, but it doesn't print the

What's the fastest way to delete a large folder in Windows?

泄露秘密 提交于 2019-11-27 16:33:02
I want to delete a folder that contains thousands of files and folders. If I use Windows Explorer to delete the folder it can take 10-15 minutes (not always, but often). Is there a faster way in Windows to delete folders? Other details: I don't care about the recycle bin. It's an NTFS drive. Use Windows Command Prompt: rmdir /s /q folder Hugo The worst way is to send to Recycle Bin: you still need to delete them. Next worst is shift+delete with Windows Explorer: it wastes loads of time checking the contents before starting deleting anything. Next best is to use rmdir /s/q foldername from the

Tips for managing a large number of files?

给你一囗甜甜゛ 提交于 2019-11-27 11:45:06
问题 There are some very good questions here on SO about file management and storing within a large project. Storing Images in DB - Yea or Nay? Would you store binary data in database or in file system? The first one having some great insights and in my project i've decided to go the file route and not the DB route. A major point against using the filesystem is backup. But in our system we have a great backup scheme so i am not worried about that. The next path is how to store the actual files.

How do I stop emacs dired mode from opening so many buffers?

拥有回忆 提交于 2019-11-27 10:45:08
问题 When I use dired mode to browse around and find a file I want to open in Emacs, dired opens a new buffer for each directory I visit when looking for the file each time I select a directory with Enter , which means I can end up with a lot of buffers I don't want: . * newer 0 Fundamental c:/work/stackoverflow/batch/mydir/newer % mydir 302 Dired by name c:/work/stackoverflow/batch/mydir/ % batch 616 Dired by name c:/work/stackoverflow/batch/ % stackoverflow 1017 Dired by name c:/work