开发者

Append Filename of Txt Files on a Line Inside the File Notepad++

I 'm not a coder/programmer so my knowledge about regex is limited on what I can find on Google and sites like stackoverflow.

I have a series of files, around 10k with differen开发者_C百科t filenames. Now I want to put the specific filename of each file into a line within the txt file, preferably on the first or last line of the file.

So if I have a file with the filename Caste "System in Nepal.txt" I want to see "Caste System in Nepal" on either the first or second line of the txt, without the quotes.

Can anybody help me? Thanks a lot. :)


Have a go with the following:

(.+?)\.\w+

The bit in the brackets you'd then use for your file name. This assumes that there is only one dot in the filename before the extension. Otherwise, if you have filenames like Document.name.txt, you'll need a more complex regex.


I'm not sure you can do this from within Notepad++ as you'll need the list of files to begin with. If you already have this then you can use find and replace to find .txt (if they all have the .txt extension) and replace it with nothing. If you have other extensions then try a regexp like \.[^\.]$ and replace it with nothing. That should match the last fullstop and everything after it.

If you don't have the list of files in your text editor then you can get them from a Bourne compatible shell with something like find . -type f -print > ../file-you-want-the-list-in.txt run in the directory with all the files in.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜