开发者

find files that start with the same set of charecters Linux

开发者 https://www.devze.com 2023-02-21 20:06 出处:网络
In an attempt to backup their website a client of mine ended up duplicating every file and directory in my php apps file system.Each file begins: C:\\Users\\Nick\\Desktop... then the path to the file

In an attempt to backup their website a client of mine ended up duplicating every file and directory in my php apps file system. Each file begins: C:\Users\Nick\Desktop... then the path to the file within my file system.

I tried writing a regular expression to find every file that begins with that string but I'm having trouble, I've not used regular expressions very often and I find them very confusing. This would be a good opportunity to learn a bit more about them, but I'm swamped and this pro开发者_高级运维blem was completely unexpected. Would someone share their expertise?

Thanks


If it just begins with the same string every, time there's no need for a regular expression - just use the normal string search of your platform. The regular expression for constant values is just the constant value, in your case:

^C:\\Users\\Nick\\Desktop\\

^ matches only the start of the input (file name), and backslashes need to be escaped.

0

精彩评论

暂无评论...
验证码 换一张
取 消