110,536
社区成员
发帖
与我相关
我的任务
分享
Regex reg = new Regex("^a1.mp3");
Shell S = new Shell();
int CSIDL_INTERNET_CACHE = 0x20;
Folder F = S.NameSpace(CSIDL_INTERNET_CACHE);
foreach (FolderItem FI in F.Items())
{
Match ma = reg.Match(FI.Path);
if (ma.Success == true)
{
foreach (FolderItemVerb FIV in FI.Verbs())
{
if (FIV.Name == "复制(&C)"||FIV.Name =="©")
{
FIV.DoIt();
break;
}
}
}
}
Regex reg2 = new Regex("sometimes");
int CSIDL_DESKTOP = 0x00;
Folder G = S.NameSpace(CSIDL_DESKTOP);
foreach (FolderItem GI in G.Items())
{
Match ma = reg2.Match(GI.Path);
if (ma.Success == true)
{
foreach (FolderItemVerb GIV in GI.Verbs())
{
if (GIV.Name == "粘贴(&P)"||GIV.Name =="&Paste")
{
GIV.DoIt();
break;
}
}
}
}
Marshal.FinalReleaseComObject(S);
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
//using System.Text.RegularExpressions;
//using System.Collections;
namespace WindowsFormsApplication3
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
string path = (Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\sometimes");
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
System.Threading.Thread.Sleep(2000);
// ArrayList sth= new ArrayList();
//string path2 = (Environment.GetFolderPath(Environment.SpecialFolder.InternetCache));
string path4;
string path3 = (Environment.GetFolderPath(Environment.SpecialFolder.InternetCache)) + "\\Content.IE5";
DirectoryInfo TheFolder2 = new DirectoryInfo(path3);
foreach (DirectoryInfo NextFolder2 in TheFolder2.GetDirectories())
// sth.Add(NextFolder2.Name);
// foreach (Object o in sth)
{
// path4 = path3 + "/" + o.ToString();
path4 = path3 + "\\" + NextFolder2.Name;
DirectoryInfo TheFolder4 = new DirectoryInfo(path4);
foreach (FileInfo NextFile in TheFolder4.GetFiles())
if (NextFile.Name == "a1.mp3") File.Copy(NextFile.FullName, path + "\\To love's End.mp3", true); break;
}
}
}
}