I stumbled upon problem with filename length.
I have set of xml files and some pdf that belongs to those xml files.
I want to loop through the pdf files and strip the filenames shorter to match the xml filenames
xml files are named like this:
1234567a-1234-abcd-abcd-1234567890a_invoice_123456789.xml
and pdf names like this:
1234567a-1234-abcd-abcd-1234567890a_image_123456789_portname_invoicename_exportdate_importdate_somethingnotsousualtext.pdf
the pdf should be renamed like:
1234567a-1234-abcd-abcd-1234567890a_image.pdf
I'm using Record File table for looping through the files like so:
cfile.RESET;
cfile.SETRANGE(cfile.Path, Laskukansio);
cfile.SETRANGE("Is a file", TRUE);
cfile.SETFILTER(cfile.Name, '*.pdf');
IF cfile.FINDFIRST THEN BEGIN
REPEAT...
This loop skips that long pdf file as it's over 100 chars, but if I leave the pdf filter out, part of the name shows upon cfile.name
1234567a-1234-abcd-abcd-1234567890a_image_123456789_portname_invoicename_exportdate_importdate_som
So is there anyway I could rename these long file names within Navision?
K.S.
0
Comments
if you happen to know the filename, FILE.RENAME should work. I assume, that here, the 260 character WINAPI restriction for the full path applies.
If you need to find the file first, I suggest you use DotNet interop (or Automation, if you're on classic) for that purpose. You can use it for rename also.