Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Search short file path (tilde)
#1
Supposed that in a folder exists a short path file, ie. C:\tmp\FW730~1.eml. How is it possible to locate this file using a search engine, for example a foreach(d s FE_Dir) command. More specifically is there a way to use in this statement the tilde (~) character (actually I did not manage to elaborate it), or is there another way to do it.

Thanks in advance.
#2
Macro Macro1282
Code:
Copy      Help
_s.setfile("$temp$\abcdef~1.txt")
_s.setfile("$temp$\abcde~12.txt")
_s.setfile("$temp$\abcd~123.txt")
_s.setfile("$temp$\abc~1234.txt")

out
ARRAY(str) a
GetFilesInFolder a "$temp$" "^(.{6}~\d{1}|.{5}~\d{2}|.{4}~\d{3}|.{3}~\d{4})\.[^\.]{3}$" 0x10004
int i
for i 0 a.len
,out a[i]
#3
Dear Gintaras,

Many thanks, but my question was slightly different. In the follwing example :


Macro temp1
Code:
Copy      Help
_s="C:\tmp\???"
foreach(d _s FE_Dir)
,str sPath=d.FileName(1)
,out sPath


What is the value of ??? to enumerate files with ad least one tilde character in th filename.

Thanks
Simos
#4
Thanks again. Yes, I tried what you propose in the beginning, before writing this post. But it does not work in that it gives more files than these which they actually contain a tilde in the file name. I cannot understand why. I can send an example if you find it useful.
#5
Yes I tested it. Could use "*~*", but then finds all files. It is how Windows works. Files have 2 names - long and short with ~, and Windows (particularly FindFirstFile , that QM calls) finds both.

If want to use FE_Dir or dir, need to get all files and then use findc('~') or other string function.
#6
Perfect advice. Best regards.


Forum Jump:


Users browsing this thread: 1 Guest(s)