如何移动文件和显示无法移动的文件 [英] How to move Files and diaplay the files which cannot be moved
本文介绍了如何移动文件和显示无法移动的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想将一些文件移动到目标目录。
如果文件名已经存在,我想存储在列表中
如何在不移动时存储文件
I want to move some files to destination directory.
If a file name already exists I want to store in a list
How to store the files while are not moved
推荐答案
如何在不移动时存储文件
我喜欢的任何地方我会说。
这里有一个方便的小清单:< br $> b $ b
"How to store the files while are not moved"
Anywhere you like I'd say.
Here's a small list for your convenience:
- 使用集合,最好使用像List< String>这样的通用集合。或列表< FileInfo>。 * 1
- 使用数组或arraylist。 (不推荐)。
- 将这些文件的路径存储在文本文件中。
- 将路径存储在RDMBS或NoSQL DB中。
* 1
*1
// Before the loop processing the files
List<String> notMovedFiles = new List<String>();
// This is inside the loop processing the files
if(fileNotMoved)
{
notMovedFiles.Add(theFilePath);
}
干杯!
Cheers!
这篇关于如何移动文件和显示无法移动的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文